Re: PHP and MySQL form problems
Firstly, what is your error when using $_SERVER['DOCUMENT_ROOT']?
I would change this line...
if(!ereg($page, $_SERVER['HTTP_REFERER']))
to this...
if(!eregi("pagename.php", $_SERVER['HTTP_REFERER']))
This line...
$result = mysql_query($query);
Alter to...
$result = mysql_query($query) or die(mysql_error());
This is useful for debugging your script and will return any errors returned by MySQL.
Finally...
$query = INSERT INTO table_name VALUES ('', 'fname', 'lname', 'phone', 'fax', 'email', 'message');
Should be...
$query = "INSERT INTO table_name ('field','fname','lname','phone','fax','email','message') VALUES ('', 'fname', 'lname', 'phone', 'fax', 'email', 'message')";
That this then let us know.
Regards,
Martyn Coupland
Development Officer