Hi everybody
Can someone please tell me what is wrong with my code? I m going crazy.
here is a part of my html codeI will be really appreciate 😕 😕 😕 😕
Name: <input type="text" name="Name" size="24">
Res. Phone:<input type="text" name="Resphone" size="24">
E-mail:<input type="text" name="Email" size="24">
Bookshelves, per section<input type="text" size="2" maxlength="3" name="item2"><input type="hidden" name="weight2" value="65"><input type="hidden" name="name2" value="Bookshelves, per section">
Chair, Arm<input type="text" size="2" maxlength="3" name="item3"><input type="hidden" name="weight3" value="60"><input type="hidden" name="name3" value="Chair, Arm">
Chair Rocker (wood)<input type="text" size="2" maxlength="3" name="item4"><input type="hidden" name="weight4" value="40"><input type="hidden" name="name4" value="Chair Rocker (wood)"></td>
here is my php code
session_start();
$customer_name = $POST[ 'GI_name' ] ;
$customer_resphone = $POST[ 'GI_resphone' ] ;
$customer_email = $POST[ 'GI_email' ] ;
$customer_businessphone = $POST[ 'GI_busphone' ] ;
$customer_fax = $_POST[ 'GI_fax' ] ;
$move_movefrom = $POST[ 'MI_MoveFrom' ] ;
$move_moveto = $POST[ 'MI_MoveTo' ] ;
$move_movedate = $POST[ 'MI_MoveDate' ] ;
$move_norooms = $POST[ 'MI_NoRooms' ] ;
$move_sqfthouse = $_POST[ 'MI_SqftHouse' ] ;
$otherinfo = $POST[ 'OtherInfo' ] ;
$othertopics = $POST[ 'OtherTopics' ] ;
$body = 'Name : ' . $customer_name ."\n"
. 'Res. Phone : ' . $customer_resphone."\n"
. 'Bus. Phone : ' . $customer_businessphone."\n"
. 'Fax : ' . $customer_fax."\n"
. 'EMail : '. $customer_email."\n"
. 'Move From : ' . $move_movefrom."\n"
. 'Move To : ' . $move_moveto."\n"
. 'Move Date : ' . $move_movedate."\n"
. 'No of Rooms :' .$move_norooms."\n"
. 'House Area : ' .$move_sqfthouse."\n"
. 'Other Info :'. $otherinfo."\n"
. 'Other Topics :'. $othertopics."\n" ;
$totalweight = 0 ;
foreach ($_POST as $item)
{
//first get each item in form
if (substr( $item ,0, 5 ) == 'item_' )
{
//get only inputboxes starting with product prefix
$itemid = substr($item ,strlen($item)-(strlen($item)-(strpos(1,$item ,'_' ,1) ? strpos(1,$item ,'_' ,1 )+1 : 0)));
$itemamount = $_POST[$item] ;
if (is_numeric($itemamount))
{
if ($itemamount > 0 )
{
$itemname = $_POST[ 'Name_' . $itemid ] ;
$itemweight = $_POST[ 'Weight_' . $itemid ] ;
$itemsum = $itemweight * $itemamount ;
$totalweight = $totalweight + $itemsum ;
$body = $body. $itemname . ':'. $itemweight .'*'. $itemamount .'='. $itemsum;
}
}
}
}
$body = $body . 'Total weight of move: ' . $totalweight . ' lbs' ;
//send order as an email
$to = 'whatever@whatever.com';
$subject = 'ESTIMATION REQUEST DETAILS';
$header = 'From: $customer_email\n'
. 'Reply-To: $customer_email\n'
. 'MIME-Version: 1.0\n'
. 'Content-type: text/plain; charset=\'ISO-8859-1\'\n'
. 'Content-transfer-encoding: quoted-printable;\n';
mail($to,$subject,$body,$header);
?>