I have a main form that has questions inside it that populate. Each question needs to be able to upload a file.
This is where I have issues, because you can't have a form within a form. With file uploads they like to be their own form. The outer form (answer_audit.php?action=post
) tries to dominate the sub form. Is there a solution to this?
I broke down the code to show what I mean, I can add more code if you need it, but I am trying to limit this to PHP and html only as much as possible:
<form role="form" action="./answer_audit.php?action=post" method="post" enctype="multipart/form-data" name="auditForm" id="auditForm" >
<a title='Upload file' href='#' do_disable='$disabled' id=$row[questionID] class='btn btn-default btn-xs “ data-toggle='modal' data-target='#uploaded_files_$row[questionID]’>
<!-- modal pop up -->
<div class='modal fade' style='z-index:10000' id='uploaded_files_$row[questionID]' role='dialog'>
<div class='modal-dialog modal-lg'>
<div class='modal-content'>
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal' aria-hidden='true'></button>
<h4 class='modal-title'>Title</h4>
</div>
<div class='modal-body'>
<form id='my_form_1$row[questionID]' name='form' action='ajax/upload.php' method='POST' enctype='multipart/form-data' target='_blank'>
<h1>Upload File</h1>
<strong>File: </strong><input name='myFile' id='myFile' type='file' />
<input id='$row[questionID]' class='upload_button' name='action' value='Upload' type='button' />
<iframe id='my_iframe' name='my_iframe' src=''></iframe>
</form>
</div>
<div class='modal-footer'>
<button type='button' class='btn btn-default' data-dismiss='modal'>Close</button>
</div>
</div>
</div>
</div>
<input class="btn btn-lg btn-success finish_button" type="button" ID="" value="Finish"/>
</form>