View Full Version : Help with my submit form :)

01-15-2010, 06:20 AM
Hello, I have a form where you submit to post on the forum however I wana know if there is a way so that when the user submits the form, on the check.php page there is some type of code that checks that the form was submitted from the correct URL.

I was thinking something like this:

if ('."http://".$_SERVER['HTTP_REFERER']);)
echo "preceed or somthing :S";
echo "error message or somthing :S";

So basically the form is on "Form.php" and if a user takes the source code and submits the form from "http://theresite.com/form.php" it will give an error, so it will only accept it from "form.php"


You can find the demo at http://googl3.tk/post.php

01-15-2010, 06:39 AM
You mean sumthing like this?

if ($_SERVER['HTTP_REFERER']=='form.php'){
echo "preceed or somthing :S";
echo "error message or somthing :S";

header('Location: thankyou.php'); to redirect people to another page

01-15-2010, 07:06 AM
Yes, how can I make it so if it didn't come from form.php they get an error, and the form doesn't go through to the mysql database :)