kryppienation Posted October 29, 2008 Share Posted October 29, 2008 I have more than one form on a page that is going back to itself. When calling the form how do i incorporate the form name so that my code only runs if either or was clicked. What is happening, is both statements are being executed when only one should be because i don't know how to call a $_POST and incorporate the form name so that i am getting the right form. Quote Link to comment https://forums.phpfreaks.com/topic/130544-solved-form-handling/ Share on other sites More sharing options...
solon Posted October 29, 2008 Share Posted October 29, 2008 can you post your code? Quote Link to comment https://forums.phpfreaks.com/topic/130544-solved-form-handling/#findComment-677243 Share on other sites More sharing options...
bobbinsbro Posted October 29, 2008 Share Posted October 29, 2008 i think i understand what you want... give each submit button a different value, and check for existence in $_POST. example: <form name = "form1" action = "bla.php" method = "post"> <!-- some form elements --> <input type = "submit" name = "form1" value = "Submit" /> </form> <form name = "form2" action = "bla.php" method = "post"> <!-- some form elements --> <input type = "submit" name = "form2" value = "Submit" /> </form> <form name = "form3" action = "bla.php" method = "post"> <!-- some form elements --> <input type = "submit" name = "form3" value = "Submit" /> </form> then in the php section check if whichever 1 of the sumbit buttons isset, and execute code. i think this won't work if you don't actually separate the forms from each other in the HTML. Quote Link to comment https://forums.phpfreaks.com/topic/130544-solved-form-handling/#findComment-677245 Share on other sites More sharing options...
kryppienation Posted October 29, 2008 Author Share Posted October 29, 2008 and check for existence in $_POST. This is what i don't know how to do. The forms are all separate, they all have different form names, and different submit button names. Quote Link to comment https://forums.phpfreaks.com/topic/130544-solved-form-handling/#findComment-677250 Share on other sites More sharing options...
bobbinsbro Posted October 29, 2008 Share Posted October 29, 2008 if (isset($_POST['valueOfDesieredSubmitButton'])){ .....code } Quote Link to comment https://forums.phpfreaks.com/topic/130544-solved-form-handling/#findComment-677255 Share on other sites More sharing options...
kryppienation Posted October 29, 2008 Author Share Posted October 29, 2008 Thanks a lot for your time!! This will be wonderful. Quote Link to comment https://forums.phpfreaks.com/topic/130544-solved-form-handling/#findComment-677259 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.