PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have the following code, but in my text.txt output file, the values of $name and $email are not getting stored. Also in the Thank you message, the $name value is not displayed. Any help would be greatly appreciated.
Thank you. I tried that, but didn't make any difference. In fact those three lines were added on later. The $name & $email values were not getting displayed or saved even without those lines. The script actually do write out the ****** line and the word "Name: " in the text.txt output as well, but not the values of the passing parameters. I tried GET method and I can see the values being passed to the mytest.php file as well. Very strange problem.
I am running this on my localhost running the latest install of WAMP. Any other suggestions? Is it working for you?
anjanesh wrote:Rather than checking if the submit button has been submitted, check if all fields of the form have been submitted (expect checkboxes, if any)
I had brought this up in another thread recently, but you should never check that a button value has been passed. Instead you should check if the post array is empty or better, if the request method is post:
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Form was submitted
}
?>
In some browsers, when you hit the enter key inside of the form without actually hitting the submit button, the form will submit but the form button, because it wasn't activated, will not be sent with the post data. So checking for it will return false.
Everah wrote:I had brought this up in another thread recently, but you should never check that a button value has been passed. Instead you should check if the post array is empty or better, if the request method is post:
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Form was submitted
}
?>
In some browsers, when you hit the enter key inside of the form without actually hitting the submit button, the form will submit but the form button, because it wasn't activated, will not be sent with the post data. So checking for it will return false.
Thank you for the input. Interestingly enough I just added a Radio button to my page.