Jump to content

PHP: How to check when a submit button is pressed from the Iframe form


halben

Recommended Posts

If you have more than one submit button and want to know which one was pressed, you can give the buttons unique names and/or values and look at them. Or, you can use a hidden form field with a value unique to the form. Or, you can put a unique ?formID=foobar appended to the url of the form action url.

 

However, note that php cannot directly detect if a form button was pressed. php is parsed server-side. Button click events happen client-side. Even if you do one of the above methods, there is no guarantee that the user actually pressed that button. Some browsers allow for "Enter" to be pressed to invoke the click. Or, javascript could be used to invoke the submit. Or someone could write a script or use a program to otherwise programatically make a request to the script with relevant values.

Link to comment
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.