Jump to content

[SOLVED] Form Handling


kryppienation

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/130544-solved-form-handling/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/130544-solved-form-handling/#findComment-677245
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.