Reputation: 341
having some issues with a callback request form I'm trying to build for a mobile Web site. Basically the problem is that I'm receiving the email but the fields are empty, as if it has been sent with nothing entered into the input fields. Obviously there must be a problem with PHP grabbing my fields and posting them, but I can't seem to figure out what I'm doing wrong:
<?php
$EmailFrom = $_POST['ftEmail'];
// $EmailTo = "[email protected]";
$EmailTo = "[email protected]";
$Subject = "Call back request from a mobile";
$Name = Trim(stripslashes($_POST['ftName']));
$Email = Trim(stripslashes($_POST['ftEmail']));
$Tel = Trim(stripslashes($_POST['ftTel']));
/* - IF NEED TO CONNECT TO DATABASE
$con = mysql_connect("xxx","xxx","xxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("farmpro1_mosuro", $con);
$sql="INSERT INTO contact_form (Name, Tel, Email)
VALUES
('$_POST[Name]','$_POST[Tel]','$_POST[Email]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
*/
// email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "\n";
// send the email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to thank you page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contact_thanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
mysql_close($con)
?>
<form action="send_request_mobile.php">
<input type="text" value="ftName" name="ftName" id="ftName"><br>
<input type="text" value="ftEmail" name="ftEmail" id="ftEmail"><br>
<input type="text" value="ftTel" name="ftTel" id="ftTel">
<input type="submit" value="SEND" class="ftSubmit">
</form>
Any help and that would be great!
Thanks,
Upvotes: 0
Views: 72
Reputation: 943560
Your form has no method
attribute, so it defaults to GET
and you are looking for data in $_POST
.
<form action="send_request_mobile.php" method="post">
Upvotes: 4