|
Posted by Jerry Stuckle on 02/21/07 11:20
mosesdinakaran@gmail.com wrote:
> Hi All,
>
> I need a small clarification in submitting the forms, Ur
> suggestions please.
>
> In a page I have two form and also two submit butons.
>
>
> (ie)
>
> <form name="myform" action="test.php" method="post" >
> <input type="text" name="myform_name" >
> <input type="text" name="myform_id" >
> <input type="text" name="myform_no" >
> <input type="submit" value="Submit" />
> </form>
>
> <form name="myform1" action="test.php" >
> <input type="text" name="myform1_name" >
> <input type="text" name="myform1_id" >
> <input type="text" name="myform1_no" >
> <input type="submit" value="Submit" />
> </form>
>
> Now is it possible to submit all the elements from the two form when I
> click any one of the submit button.
>
>
>
> Thanks & Regards
> Moses
>
Moses,
As others have said, you can do it with javascript, but many users have
javascript disabled.
However, you have the same target on both forms - you don't need two
forms. You can do it with:
<form name="myform" action="test.php" method="post" >
<input type="text" name="myform_name" >
<input type="text" name="myform_id" >
<input type="text" name="myform_no" >
<input type="submit" name="Submit" value="First Button" />
<input type="text" name="myform1_name" >
<input type="text" name="myform1_id" >
<input type="text" name="myform1_no" >
<input type="submit" name="Submit" value="Second Button" />
</form>
Notice you didn't have a name attribute for your submit button. I added
one so you can fetch the results. Now, in test.php, $_POST['Submit']
will contain "First Button" or "Second Button" and all fields will be
filled in. No javascript needed.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|