kreut Posted February 21, 2011 Share Posted February 21, 2011 Hello! I've got several forms on one page that use the same variable names for input values. (Say, form1, form2, and form3). I'm using javascript to show only one of the forms based on a selection (say British, American, Canadian). How can I write code which will tell the page to ONLY look at the variables from a particular form when I hit the submit button for one of the forms? Thanks so much.... Quote Link to comment https://forums.phpfreaks.com/topic/228397-multiple-forms/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 21, 2011 Share Posted February 21, 2011 You only receive the data/variables from the form that was submitted. Quote Link to comment https://forums.phpfreaks.com/topic/228397-multiple-forms/#findComment-1177686 Share on other sites More sharing options...
Veteah Posted February 21, 2011 Share Posted February 21, 2011 Yep, if you had say: <form action="somepage.php" method="post"> <input type="text" name="english_somthing" /> <input type="submit" name="submit_english" /> </form> <form action="somepage.php" method="post"> <input type="text" name="spanish_somthing" /> <input type="submit" name="submit_spanish" /> </form> If you were to press submit one the English form, only the input from that form, not the Spanish, would be passed. Quote Link to comment https://forums.phpfreaks.com/topic/228397-multiple-forms/#findComment-1177694 Share on other sites More sharing options...
kreut Posted February 21, 2011 Author Share Posted February 21, 2011 thank you both for such quick responses! Quote Link to comment https://forums.phpfreaks.com/topic/228397-multiple-forms/#findComment-1177704 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.