OK - firstly no forward slash in front of the Tildes and a Return after each set of Tildes to get code to show.
This is your form code:
<?php $notindomain_errorpage = "error.html"; $server_errorpage = "error.html"; $invalidaddress_errorpage = "error.html"; $successpage = "success.html"; $recipient="email@hidden"; $subject="Demande Info location"; // Set the server variables for older (PHP4,3 etc) systems if (!isset($_SERVER)){ $_POST = &$HTTP_POST_VARS; $_SERVER = &$HTTP_SERVER_VARS; } $servername = $_SERVER['SERVER_NAME']; if ($_SERVER['REQUEST_METHOD']=="POST") { if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])>7 || !strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) { header( "Location: ".$notindomain_errorpage ); exit; } else { $msg="The following information was submitted from a form on ".$servername.":nn"; foreach($_POST as $key => $val) { //filter out any form items called send or reset //image based submit and reset buttons will be in the format // send_x: 13 // send_y: 10 $myKeySlice = substr("$key",0,4); if ($myKeySlice != "send" && $myKeySlice != "rese"){ if ($key == "subject" || $key == "email" || $key == "name"){ //Prevent injection attacks by stripping tags and newlines from the data //Do this only on data that makes it into the e-mail header as newlines in a message body should still be valid $key = strip_tags($key); $val = strip_tags($val); if (eregi("r",$key) || eregi("n",$key)){ header( "Location: ".$notindomain_errorpage ); exit; } if (eregi("r",$val) || eregi("n",$val)){ header( "Location: ".$notindomain_errorpage ); exit; } } //replace any underscores in the input names (PHP puts these in!) with spaces $key = str_replace("_"," ",$key); //if the form item is called "subject" then set this as the subject line of the mail if ($key == "subject"){ $subject=$val; } else { if (is_array($val)){ $msg.="Item: $keyn"; foreach($val as $v) $msg.=" $vn"; } else { $msg.="$key: $valn"; } } } } //set up the default headers $headers = ""; //get the senders name (if specified) if ($_POST["name"]) { $name = $_POST["name"]; } else { $name = ""; } //get the senders email address (if specified) if (isset($_POST["email"])) { $email = $_POST["email"]; $domain = explode('@', $email); if ( !preg_match('/^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-.]+.[a-zA-Z]+(.[a- zA-Z]+)?$/', $email) || !checkdnsrr($domain[1]) ){ header( "Location: ".$invalidaddress_errorpage ); exit; } } else { //the email is missing! //strip the domain from the address //www.domain.com -> domain.com if (substr($servername,0,4) == "www."){ $theaddress = substr($theaddress,4); } $email = "noreply@".$theaddress; $msg.="nn------------------------------------------------------------------"; $msg.="nPLEASE NOTE: This is a message from the ".$servername." web site"; $msg.="nand has been sent from a machine and not a person."; $msg.="nPlease do not reply to this e-mail as it will bounce."; $msg.="n------------------------------------------------------------------"; } $headers .= "From: $name <$email>rn"; //add the correct headers for plain text //see: $headers .= "MIME-Version: 1.0n"; $headers .= "Content-type: text/plain; charset="ISO-8859-1"n"; $headers .= "Content-transfer-encoding: 7bitn"; $headers .= "Reply-To: $emailrn"."Return-Path: $email"; error_reporting(0); if (mail($recipient, $subject, $msg, $headers)){// header( "Location: ".$successpage ); } else { header( "Location: ".$server_errorpage ); } } } else { header( "Location: ".$server_errorpage ); } ?>
The problem with doing it this way is that even though you uploaded the contact-go.php file when you used the action a new file was created called contact-goa.php which was used by the action and not the one you uploaded.
<form action="contact-goa.php" method="post" name="form1" onsubmit="return(VerifyForm('form1'));">
Ideally what you want to do is use the action, publish to create the contact-go.php file.
Modify the contact-go.php file - I would then rename it to something like formhandler.php and upload it to the server.
Then remove the PHPFF action from the page (or wherever you have apppled it)
Use Page>Form setup and set this to Method: Post and Action: formhandler.php (making sure that you have the correct path to the uploaded file)
Now the form will use the custom formhandler file and you don’t have to worry that this will be overwritten by FW every time you upload the site.
As an aside your FW contact page does NOT need to have the .php suffix and if you keep it as .html you will be able to preview it locally.
David
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options