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!
<?php
if($visitormail=="" && $phone==""){
echo "<p class='content'><b>Error</b></p><p class='content'>Please <a href='javascript:history.go(-1)'>go back</a> and enter an e-mail address or phone number so we can contact you.";
}
?>
Your conditional seems ok to me, so I would guess that the problem is occuring elsewhere in your script. I see you're explicitly checking variable names, are you using register_globals? If you could post the rest of your code we could probably spot the issue. Thanks!
So on the dummy form that I created, everything seems alright to me. My advice would be to dump that $_POST superglobal and take a look at what's actually coming back from the form you're using to post to this script. Just shove a:
At the of the script you posted and see what you get. I'm guessing that maybe there's a typo on a form field name on the form posting to this script or something along those lines. Let me know what you find.
nowaydown1 wrote:So on the dummy form that I created, everything seems alright to me. My advice would be to dump that $_POST superglobal and take a look at what's actually coming back from the form you're using to post to this script. Just shove a:
At the of the script you posted and see what you get. I'm guessing that maybe there's a typo on a form field name on the form posting to this script or something along those lines. Let me know what you find.
thanks again for the reply. I printed the $_POST array and this is what came up:
It looks like the element on your form is called 'vistormail', but your script is checking for 'visitormail'. Try to make them both the same and see if that doesn't do it for ya.