Jump to content

Form Submission Help!


poleman

Recommended Posts

Hi, where am I going wrong with this form....

 

Here's the form code:

<form method="POST" action="contact.php">
                                <span lang="en-gb"><font size="2" face="Verdana">Name: 
                </font></span><input type="text" name="T1" size="20"><br>
                                <br>
                <span lang="en-gb"><font size="2" face="Verdana">Email: </font> 
                </span><input type="text" name="T1" size="30"><span lang="en-gb">  
                <font size="2" face="Verdana">Phone: </font> <input type="text" name="T2" size="20"><br>
                 </span></p>
              
                <span lang="en-gb"><font size="2" face="Verdana">Query: 
                </font></span><textarea rows="15" name="S1" cols="40"></textarea></p>
                <p align="justify"><span lang="en-gb">             
                </span><input type="submit" value="Submit" name="B2"></p>
              </form>

 

and here's the php code:

 

<?PHP

error_reporting(E_ERROR | E_WARNING | E_PARSE);
ini_set('track_errors', true);

function DoStripSlashes($FieldValue) 
{ 
if ( get_magic_quotes_gpc() ) { 
  if (is_array($FieldValue) ) { 
   return array_map('DoStripSlashes', $FieldValue); 
  } else { 
   return stripslashes($FieldValue); 
  } 
} else { 
  return $FieldValue; 
} 
}

#----------
# FilterCChars:

function FilterCChars($TheString)
{
return preg_replace('/[\x00-\x1F]/', '', $TheString);
}


if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ClientIP = $_SERVER['REMOTE_ADDR'];
}

$FTGT1 = DoStripSlashes( $_REQUEST['T1'] );
$FTGT2 = DoStripSlashes( $_REQUEST['T2'] );
$FTGS1 = DoStripSlashes( $_REQUEST['S1'] );



# Redirect user to the error page

if ($ValidationFailed === true) {

header("Location: http://www.jsay.co.uk/ITS/contactfailed");
exit;

}
# Email to Form Owner

$emailSubject = FilterCChars("Enquiry from ITS Website");

$emailBody = "Name : $FTGT1\n"
. "Email : $FTGT2\n"
. "Phone : $FTGS1\n"
. "";
$emailTo = "ITS <[email protected]>";
  
$emailFrom = FilterCChars("$FTGT2");
  
$emailHeader = "From: $emailFrom\n"
  . "MIME-Version: 1.0\n"
  . "Content-type: text/plain; charset=\"ISO-8859-1\"\n"
  . "Content-transfer-encoding: 8bit\n";
  
mail($emailTo, $emailSubject, $emailBody, $emailHeader);


# Redirect user to success page

header("Location: http://www.jsay.co.uk/ITS/thankyou");
exit;
?>


 

Hope you can help!! thanks!!  ???

Link to comment
https://forums.phpfreaks.com/topic/60639-form-submission-help/
Share on other sites

well, the problem is that when entering data into the fields, the page returns to the way it was but without the data that was filled in (instead of going to the success or error page) and the data from the form is not sent to the email address specified.

 

Hope you can help....

Link to comment
https://forums.phpfreaks.com/topic/60639-form-submission-help/#findComment-301726
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.