Jump to content

php and html together problem :(


freebsdntu

Recommended Posts

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

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?

Archived

This topic is now archived and is closed to further replies.

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