Tomballa Posted October 7, 2006 Share Posted October 7, 2006 Alright, I have a script that submits user inputed data to a mysql database, but I don't want the file called upon in the form to be able to be put in the url and gone to.Example: <form action='insert.php' method='post'> The insert.php file adds a new row to the database and fills in the cells with $_POST info. If I go to www.mysite.com/insert.php then a new row is inserted but no info is put in (because they didn't fill out a form).How would I go about making sure that people can only access insert.php from the page that the form is on? Link to comment Share on other sites More sharing options...
reportingsjr Posted October 7, 2006 Share Posted October 7, 2006 You can just do an if(!isset($_POST['variable']) || !isset($_POST['variable2'])){echo "message saying that you need to go to this page through the form";}else{insert into db etc..} Link to comment Share on other sites More sharing options...
Tomballa Posted October 7, 2006 Author Share Posted October 7, 2006 Thanks! It worked. Link to comment Share on other sites More sharing options...
reportingsjr Posted October 7, 2006 Share Posted October 7, 2006 No problem, there are alot of helpful people here. I also help because this community is so nice. Just ask if you have any other questions! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now