Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert 2 Form tag into a single body

Status
Not open for further replies.

egmweb

Programmer
Mar 19, 2004
147
EU
Hello Guys.

I'm building a website, and I have 2 form tags like this:

<body>
<FORM action="test1.php"...>
<FORM action="test2.php"...>
<Table...>
content
<input type=submit...>

<input type=sumit...>
</table>
</form>
</form>
</body>....

If I press on first buttom the form field execute test1.php
and If I press on the second buttom, it execute test1.php the same.

How can I do to control that?? I want to control the buttoms, when I press the first activate the first form and if I press the second it will be activate the second buttom.

Please help me to this work.

Thanks you
 
Look at structuring the page with multiple forms like this:
Code:
<form>
... buttons and inputs etc ...
</form>

<form>
... other stuff ...
</form>
That way you can have different actions (or the same if you want) - but you have to specify them in each form tag.

Hope that clears it up for you [smile]

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
Addition: If you need to be able to post the same exact inputs to two differant target pages based on which submit button the user presses, you will need to use a single form tag and then look into some simple javascript to change the action attribute of that form tag when the submit buttons are clicked. In that case you should be able to find some good examples from google or if you get hung up, from the javascript forum.

-T

barcode_1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top