Hey everyone, what I am guessing is a small problem has me stuck. Just looking for a quick pointer. Basically I have a form on my site. When you submit it, it directs you to another page that actually takes the data (via POST and stores as php variables) and then it ends up doing a couple things including sql queries and a php mail script. My problem is that I think when browsers and maybe other users are going directly to this page, it is making blank queries and sending blank emails because obviously the variables that would normally be there from the form and POST are empty, because the user browsed directly to this action page. Is there any way to stop this page from loading unless a person is referred to it from my original page that houses the form? Any ideas?
send another variable along with the post script a hidden variable and then on the receiving page check that the hidden variable = what you set it to if not do not do what is on the page.
Hy, As addition, to pass the value of the variable from a page to another, store it in $_SESSION. Also check if data was send from the form, with if(isset($_POST['field_name']))
Thank you both. I went through and did the first suggestion early this morning. In each form, I set a hidden value named 'verify' and set it to a value of 1. Then on the page that the form passed to I included the following code: $verify = $_POST["verify"]; if ($verify == 1) { INSERT-THE-REST-OF-MY-SQL-QUERIES-AND-OTHER-CODE-HERE } Code (markup): This way if someone is referred to this page or tries to run it directly, the $verify variable will not have a value of 1 and thus, wont work. Problem solved!