Posted by Erwin Moller on 04/17/06 13:39
Ian Davies wrote:
> I have the folowing script which has two forms. the first adds a record to
> a database the second uploads a file. The problem is each form has its own
> button to perform the action. What I wish to do is to combine the two
> forms and have one button to do the two actions. Please help
>
> *********************************************************************
> $q= MY INSERT SQL HERE
>
> <p class="style2"><strong>Upload A Resource </strong></p>
> <form name="form1" method="post" action="">
> <table width="607" height="304" border="0" cellpadding="0"
> cellspacing="0">
> <tr>
> TABLE WITH TEXT FIELDS HERE THAT ARE SENT TO THE DATABASE
> or</p>
> <p>
> <?php $add_order = mysql_query($q) or die('Query failed: ' .
> mysql_error());?>
> <input type="submit" name="Submit" value="Submit">
> </p>
> </div></td>
> </tr>
> </table>
> </form>
> <form enctype="multipart/form-data" action="FileProcessing.php"
> method="POST">
> <p>
> <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
>
> </p>
> <p> Choose a file to upload:
> <input name="uploadedfile" type="file" />
> <br />
> <input type="submit" value="Upload File" />
> </p>
> </form>
>
> <p> </p>
> <p class="style17 style9 style2"> </p>
>
> *********************************************************
>
> Thanks
> Ian
Hi Ian,
You sent us a script that has two forms and ask why it is not one form?
You can simply put both the fileupload part AND the regualer formfields in
one form.
You receiving script can do both action:
1) Insert the stuff in the database
2) If a file is uploaded, it takes the actions you want.
PHP is not stopping you from sending them both, neither is the browser/html.
Just try it.
Regards,
Erwin Moller
[Back to original message]
|