PDA

View Full Version : Form Help


grpaint
10-24-2006, 02:54 PM
I have a form on our website that clients fill out an estimate form and it is emailed back to us. The contact information of the customer (ie. name, address, city) will send but the rest (ie. Type of est, How they heard about us, etc.) will not.

Here is the html

<html>
<head>
<title>main</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (main.psd) -->
<FORM METHOD="POST" ACTION="form2.php">
<table id="Table_01" width="731" height="131" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="131" width="118">
<img src="../../../Grand%20Rapids%20Painting/Webpage/New%20Site/HTML%20Files/images/main_01.jpg" width="118" height="436" alt=""></td>
<td valign="top" height="142" width="613">
<p align="center"><br>
<font size="6" face="Impact" color=#005aaa>FREE ESTIMATE<br>
</font>
<font face="Arial" color=#005aaa>Please take the time to request an
estimate and we will be in contact with you shortly.</font><table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1" height="352">
<tr>
<td width="100%" height="352" valign="top">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="101%" id="AutoNumber2">
<tr>
<td width="20%">&nbsp;</td>
<td width="31%">&nbsp;</td>
<td width="3%">&nbsp;</td>
<td width="47%">&nbsp;</td>
</tr>
<tr>
<pre><td width="20%">Name:</td>
<td width="31%"> <INPUT TYPE="TEXT" NAME="name" SIZE=35 MAXLENGTH=50></td>
<td width="3%">&nbsp;</td>
<td width="47%">
<p align="center"><b>Type of estimate:</b></td>
</tr>
<tr>
<td width="20%">Address:</td>
<td width="31%"> <INPUT TYPE="TEXT" NAME="address" SIZE=35 MAXLENGTH=50></td>
<td width="3%">&nbsp;</td>
<td width="47%">
<p align="center">
<INPUT TYPE="CHECKBOX" NAME="interior" value="on">Interior Painting</td>
</tr>
<tr>
<td width="20%">City:</td>
<td width="31%"> <INPUT TYPE="TEXT" NAME="city" SIZE=35 MAXLENGTH=50></td>
<td width="3%">&nbsp;</td>
<td width="47%" align="center">
<INPUT TYPE="CHECKBOX" NAME="exterior" value="on">Exterior Painting</td>
</tr>
<tr>
<td width="20%">Zip:</td>
<td width="31%"> <INPUT TYPE="TEXT" NAME="zip" SIZE=5 MAXLENGTH=10></td>
<td width="3%">&nbsp;</td>
<td width="47%" align="center">
<INPUT TYPE="CHECKBOX" NAME="deck" value="on">Deck Staining & Sealing</td>
</tr>
<tr>
<td width="20%">E-mail Address:</td>
<td width="31%"> <INPUT TYPE="TEXT" NAME="email" SIZE=35 MAXLENGTH=50></td>
<td width="3%">&nbsp;</td>
<td width="47%" align="center">
<INPUT TYPE="CHECKBOX" NAME="powerwash" value="on">Power wash</td>
</tr>
<tr>
<td width="20%">Contact Number:</td>
<td width="31%"> <INPUT TYPE="TEXT" NAME="phonenumber" SIZE=20 MAXLENGTH=30></td>
<td width="3%">&nbsp;</td>
<td width="47%" align="center">
<INPUT TYPE="CHECKBOX" NAME="gutter" value="on">Gutter Cleaning</td>
</tr>
<tr>
<td width="20%">Best Time to Call:</td>
<td width="31%"> <INPUT TYPE="TEXT" NAME="besttime" SIZE=20 MAXLENGTH=30></td>
<td width="3%">&nbsp;</td>
<td width="47%" align="center">
<INPUT TYPE="CHECKBOX" NAME="newconstruction" value="on">New Construction</td>
</tr>
<tr>
<td width="20%">&nbsp;</td>
<td width="31%">&nbsp;</td>
<td width="3%">&nbsp;</td>
<td width="47%">&nbsp;</td>
</tr>
<tr>
<td width="51%" colspan="2">
<p align="center"><b>How did you hear about our company:</b></td>
<td width="3%">&nbsp;</td>
<td width="47%">
<p align="center"><b>Best Time For Estimate:</b></td>
</tr>
<tr>
<td width="51%" colspan="2">
<INPUT TYPE="CHECKBOX" NAME="flyer" value="on">Flyer</td>
<td width="3%">&nbsp;</td>
<td width="47%">Date: <INPUT TYPE="TEXT" NAME="estdate" SIZE=5 MAXLENGTH=10></td>
</tr>
<tr>
<td width="51%" colspan="2">
<INPUT TYPE="CHECKBOX" NAME="familycoupon" value="on">Family Coupon</td>
<td width="3%">&nbsp;</td>
<td width="47%">Time: <INPUT TYPE="TEXT" NAME="esttime" SIZE=5 MAXLENGTH=10></td>
</tr>
<tr>
<td width="51%" colspan="2">
<INPUT TYPE="CHECKBOX" NAME="phonead" value="on">Phone Ad</td>
<td width="3%">&nbsp;</td>
<td width="47%">&nbsp;</td>
</tr>
<tr>
<td width="51%" colspan="2">
<INPUT TYPE="CHECKBOX" NAME="pastcustomer" value="on">Past Customer</td>
<td width="3%">&nbsp;</td>
<td width="47%" rowspan="3">
<p align="center">


<INPUT TYPE="submit" VALUE="Submit"> or <input type="reset" value="Clear"></pre></td>







</tr>
<tr>
<td width="51%" colspan="2">
<INPUT TYPE="CHECKBOX" NAME="referred" value="on">Referred <INPUT TYPE="TEXT" NAME="referred2" SIZE=25 MAXLENGTH=40></td>
<td width="3%">&nbsp;</td>
</tr>
<tr>
<td width="51%" colspan="2">
<INPUT TYPE="CHECKBOX" NAME="other" value="on">Other <INPUT TYPE="TEXT" NAME="other2" SIZE=25 MAXLENGTH=40></td>
<td width="3%">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- SCRIPT CONFIGURATION SECTION -->
<INPUT TYPE="HIDDEN" NAME="required"
VALUE="name,phonenumber">
<INPUT TYPE="HIDDEN" NAME="data_order"
VALUE="name, address, city, zip, email, phonenumber, besttime, interior, exterior, deck, powerwash, gutter, newconstruction, flyer, familycoupon, phonead, pastcustomer, referred, referred2, other, other2, estdate, esttime">
<INPUT TYPE="HIDDEN" NAME="submit_to" VALUE="grpaint@yahoo.com">
<INPUT TYPE="HIDDEN" NAME="automessage" VALUE="mymessage">
<INPUT TYPE="HIDDEN" NAME="outputfile" VALUE="form1">
<INPUT TYPE="HIDDEN" NAME="countfile" VALUE="form1">
<INPUT TYPE="HIDDEN" NAME="emailfile" VALUE="form1">
<INPUT TYPE="HIDDEN" NAME="form_id" VALUE="My Test Form">
<INPUT TYPE="HIDDEN" NAME="ok_url"
VALUE="http://www.grpaint.com/thankyou.html">
<INPUT TYPE="HIDDEN" NAME="not_ok_url"
VALUE="http://www.grpaint.com/error.html">
<!-- END OF SCRIPT CONFIGURATION SECTION -->
<!-- End ImageReady Slices -->
</form>
</body>
</html>
and here is the php code


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<title>Untitled Document</title>

</head>



<body>

<?php



//general contact info



$name = $_POST['name'];

$phonenumber = $_POST['phonenumber'];



//$data_order = $_POST['data_order'];



$address = $_POST['address'];

$city = $_POST['city'];

$zip = $_POST['zip'];

$email = $_POST['email'];

$phonenumber = $_POST['phonenumber'];

$besttime = $_POST['besttime'];



//estimate info



$estimateType[0] = $_POST['interior'];

$estimateType[1] = $_POST['exterior'];

$estimateType[2] = $_POST['deck'];

$estimateType[3] = $_POST['powerwash'];

$estimateType[4] = $_POST['gutter'];

$estimateType[5] = $_POST['newconstruction'];



$estimateName[0] = "-interior";

$estimateName[1] = "-exterior";

$estimateName[2] = "-deck";

$estimateName[3] = "-powerwash";

$estimateName[4] = "-gutter";

$estimateName[5] = "-newconstruction";



//how did you hear about us info

$hearfrom[0] = $_POST['flyer'];

$hearfrom[1] = $_POST['familycoupon'];

$hearfrom[2] = $_POST['phonead'];

$hearfrom[3] =$_POST['pastcustomer'];

$hearfrom[4] = $_POST['referred'];

$hearfrom[5] = $_POST['other'];





$hear[0] = "-flyer";

$hear[1] = "-family coupon";

$hear[2] = "-phone ad";

$hear[3] = "-past customer";

$hear[4] = "-".$_POST['referred2'];

$hear[5] = "-".$_POST['other2'];



//Best time for est

$estdate = $_POST['estdate'];

$esttime = $_POST['esttime'];





//organize Estimate Type

$c=0;

$c1=0;

$est[5];

while($c <= 5){

if($estimateType[$c] == "on")

{

$est[$c1]=$estimateName[$c];

$c1++;

}

$c++;

}

//organize hear from type

$hearfrom[5];

$c=0;

$c1=0;

$ad[5];

while($c <= 5){

if($hearfrom[$c] == "on")

{

$ad[$c1]=$hear[$c];

$c1++;

}

$c++;

}

$letterBody=

"customer's name: ".$name. "\n".

"\n".

"customer's phone number: ".$phonenumber."\n".

"\n".

"customer's address"."\n".

$address."\n".

$city.", ".$zip.

"\n".

"Email: ".$email."\n".

"\n".

"Phone Number: ".$phonenumber."\n".

"Best time for calling is ".$besttime."\n".

"Est Date: ".$estdate."\n".

"Est Time: ".$esttime."\n".

"\n".

"Requesting estimates in:\n".

$est[0]."\n".

$est[1]."\n".

$est[2]."\n".

$est[3]."\n".

$est[4]."\n".

$est[5]."\n".

"\n".

"The following customer was refered to you by"."\n".

$ad[0]."\n".

$ad[1]."\n".

$ad[2]."\n".

$ad[3]."\n".

$ad[4]."\n".

$ad[5]."\n";

$mailAddress = "hisvictoryrose@yahoo.com";

$subject = "A GRpaint quote request from ".$name;

//echo $letterBody;



if (mail($mailAddress, $subject , $letterBody))

{

echo("<p>Message successfully sent!</p>");

}

else

{

echo("<p>Message delivery failed...</p>");

}



//mail($mailAddress, "New Quote request from".$name , $letterBody);

?>

</body>

</html>



Any help will be appreciated.

NancyJ
10-24-2006, 03:11 PM
what exactly is the email output you're getting?

grpaint
10-24-2006, 03:27 PM
http://www.grpaint.com/form.jpg - snapshot of estimate

Here is the email

http://www.grpaint.com/email.jpg - snapshot of email

rafiki
10-24-2006, 03:32 PM
double posting? that a bug in forum or users being arragont and ignoring rules!

grpaint
10-25-2006, 12:02 AM
didn't mean to double post. I just wanted to be more detailed in my question so someone can answer it.

CFMaBiSmAd
10-25-2006, 05:19 AM
I tested this, short of sending an actual email, and when I echoed the $letterBody variable, it contained the expected contents. I see in your code a commented echo statement. When you echo this, do you get the expected contents???

I don't see anything that would prevent a plain text email from sending this contents (the dash - in front of the names is permitted as far as I know, you could try changing this to some other character.)

When this form/email code was the version without the table for the form, did all the values get sent in the email or have these never worked?

grpaint
10-26-2006, 06:59 PM
Yes it works fine without the form being in tables. Thats what I dont' understand.