halben Posted September 30, 2013 Share Posted September 30, 2013 Hi, I am hoping someone could please help/guide in the right direction. I have a form in an iframe and I want to use PHP to check when the user has pressed the submit button in the iframe form. How would I approach on doing this? Thanks, Hal Quote Link to comment Share on other sites More sharing options...
wright67uk Posted October 5, 2013 Share Posted October 5, 2013 You could put the form processing on the same page as your I frame source file. Form here... <input type="submit" value="Submit" name="submit"/> </form> <?php if(isset($_POST['submit']) && ($_POST['submit'] == "Submit")) { Page here... Quote Link to comment Share on other sites More sharing options...
.josh Posted October 5, 2013 Share Posted October 5, 2013 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. Quote Link to comment 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.