Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.