freebsdntu Posted December 17, 2007 Share Posted December 17, 2007 I wrote a php registration file which contains both the presetation - the form, and the logic to get the user input. The problem is when loading the page, the php logic will be executed even when user has not entered anything yet, how do I handle this problem? Previously I created two seperate files, register.html and register.php, where the form action would trigger register.php, and it worked fine. Any hints?Thank you very much! Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 17, 2007 Share Posted December 17, 2007 put in a hidden field in your form say <input type="hidden" name="submitform" value="Yes"> and then check if (isset($_POST['submitform']) && $_POST['submitform'] == 'Yes') { .. your form processing code here } Quote Link to comment Share on other sites More sharing options...
freebsdntu Posted December 17, 2007 Author Share Posted December 17, 2007 put in a hidden field in your form say <input type="hidden" name="submitform" value="Yes"> and then check if (isset($_POST['submitform']) && $_POST['submitform'] == 'Yes') { .. your form processing code here } should the input tag be form tag,I guess? Thank you very much,rajivgonsalves. Now it works fine! Can you also give me some explanations on that? Quote Link to comment Share on other sites More sharing options...
freebsdntu Posted December 17, 2007 Author Share Posted December 17, 2007 Ah,sorry,my fault,I did a google search just now, and it is input tag. But I tried with the form tag, it works as well, don't know why. 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.