Hi...
I have a product on a site (not finished) that needs a php form put in. I have put the form into the detailed description of the item...easy enough, right?
Here is the link to view the form.
I tell the form to post to the php handler, but when you hit submit...it just takes you to your cart. Weird. I know that I have the error and success pages put in the correct place.
Oh and the email does not send, either.
Can someone review my code and tell me what I am doing wrong? Is there a possibility that I cannot even do this in Xcart?
Here is the HTML form, within the detailed description:
Code:
<form method="POST" action="http://www.shellypopcandles.com/store/favorrequest.php">
Fields marked "<font color="#FF0000">*</font>" are required
<table width="330" border="0">
<tr>
<td width="216">Your Email:* </td>
<td width="148"><input type="text" name="EmailFrom" size="40"></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>First Name:* </td>
<td><input type="text" name="FirstName" size="40"></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>Last Name:* </td>
<td><input type="text" name="LastName" size="40"></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>Quantity Desired:* </td>
<td><input type="text" name="QuantityDesired" size="6"></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td align="left" valign="top">Colors:*</td>
<td><input name="honeyBrown" type="checkbox" id="honeyBrown" value="HoneyBrown">
Honey Brown
<input name="txSnow" type="checkbox" id="txSnow" value="TexasSnow">
Texas Snow
<input name="creamy" type="checkbox" id="creamy" value="Creamyliscious">
Creamyliscious
<input name="brickyard" type="checkbox" id="brickyard" value="Brickyard">
Brickyard
<input name="lusciousLilac" type="checkbox" id="lusciousLilac" value="LusciousLilac">
Luscious Lilac
<input name="sage" type="checkbox" id="sage" value="Sage">
Sage
<input name="pinkyToe" type="checkbox" id="pinkyToe" value="PinkyToe">
Pinky Toe
<input name="rhythmBlues" type="checkbox" id="rhythmBlues" value="RhythmBlues">
Rhythm Blues</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td><valign="right"><input type="submit" name="submit" value="Submit"></valign></td>
</tr>
</table></form>
And here is the PHP handler...put in the proper place.
Code:
<?php
// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
$EmailTo = "info@shellypopcandles.com";
$Subject = "Favor Quote Request";
$FirstName = Trim(stripslashes($_POST['FirstName']));
$LastName = Trim(stripslashes($_POST['LastName']));
$email = Trim(stripslashes($_POST['EmailFrom']));
$QuantityDesired = Trim(stripslashes($_POST['QuantityDesired']));
$Colors = Trim(stripslashes($_POST['honeyBrown', 'txSnow', 'creamy', 'brickyard', 'lusciousLilac', 'sage', 'pinkyToe', 'rhythmBlues']));
// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "FirstName: ";
$Body .= $FirstName;
$Body .= "\n";
$Body .= "LastName: ";
$Body .= $LastName;
$Body .= "\n";
$Body .= "email: ";
$Body .= $EmailFrom;
$Body .= "\n";
$Body .= "QuantityDesired: ";
$Body .= $QuantityDesired;
$Body .= "\n";
$Body .= "Colors: ";
$Body .= $Colors;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.shellypopcandles.com/store/sent.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.shellypopcandles.com/store/error.html\">";
}
?>
I would really really appreciate the help. I am kind of new to this and I have been working on it all day!