You are here: Re: Doing two things from one submit « PHP Programming Language « IT news, forums, messages
Re: Doing two things from one submit

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>&nbsp;</p>
> <p class="style17 style9 style2">&nbsp;</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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация