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! Link to comment https://forums.phpfreaks.com/topic/82003-php-and-html-together-problem/ 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 } Link to comment https://forums.phpfreaks.com/topic/82003-php-and-html-together-problem/#findComment-416657 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? Link to comment https://forums.phpfreaks.com/topic/82003-php-and-html-together-problem/#findComment-416660 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. Link to comment https://forums.phpfreaks.com/topic/82003-php-and-html-together-problem/#findComment-416662 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.