mikeweb Posted August 23, 2006 Share Posted August 23, 2006 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>Corporate RMA Request Form - Submit Form</title><?function sendForm(){//form vars$newLine = "<br>";//populate vars from post$txtDate = $_POST["txtDate"];$SYSN["theDate"] = $_POST["txtDate"];$txtAgentName=$_POST["txtAgentName"];$txtBanNum=$_POST["txtBanNum"];$txtWirelessNum=$_POST["txtWirelessNum"];$txtCustomerName=$_POST["txtCustomerName"];$txtTicketNum=$_POST["txtTicketNum"];$txtContactName=$_POST["txtContactName"];$txtContactPhone=$_POST["txtContactPhone"];$txtContactEmail=$_POST["txtContactEmail"];$drpWirelessDevice=$_POST["drpWirelessDevice"];$txtPinNum=$_POST["txtPinNum"];$txtIMEI=$_POST["txtIMEI"];$txtSimNum=$_POST["txtSimNum"];$txtDefectNote=$_POST["txtDefectNote"];$txtShipAttentionTo=$_POST["txtShipAttentionTo"];$txtShipCompanyName=$_POST["txtShipCompanyName"];$txtShipAddress=$_POST["txtShipAddress"];$txtShipCity=$_POST["txtShipCity"];$txtShipProv=$_POST["txtShipProv"];$txtShipPostal=$_POST["txtShipPostal"];$formData='<table width="400" border="1" cellspacing="1" bordercolor="#D40139"> <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Corporate RMA Request form</span></b> </td> </tr> <tr> <td> Date: <?php "$txtDate; ?><br> TicketNum <?php echo $txtTicketNum; ?> </td> <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Customer Information</span></b> </td> </tr> <tr> <td> Customer Information<br> Ban: <?php echo $txtBanNum; ?> txtWirelessNum <?php echo $txtWirelessNum; ?><br> txtCustomerName <?php echo $txtCustomerName; ?> </td> <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Contact Information</span></b> </td> </tr> <tr> <td> txtContactName <?php echo $txtContactName; ?> txtContactPhone <?php echo $txtContactPhone; ?><br> txtContactEmail <?php echo $txtContactEmail; ?> </td> </tr> <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Device Information</span></b> </td> </tr> <tr> <td> txtPinNum <?php echo $txtPinNum; ?> txtIMEI <?php echo $txtIMEI; ?><br> txtSimNum <?php echo $txtSimNum; ?> </td> </tr> <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Defect Information</span></b> </td> </tr> <tr> <td> <textarea name="txtDefectNote" cols="35" rows="6">"<?php echo $txtDefectNote ?>"</textarea> </td> </tr> <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Shipping Information</span></b> </td> </tr> <tr> <td> txtShipAttentionTo <?php echo $txtShipAttentionTo; ?><br> txtShipCompanyName <?php echo $txtShipCompanyName; ?><br> txtShipAddress <?php echo $txtShipAddress; ?><br> txtCityProvPostal <?php echo $txtShipCity; ?> </td> </tr></table>';//populate email varsecho $newLine;$to = "[email protected]";//$headers = "From: [email protected]";$headers = "From: [email protected]\r\nContent-type: text/html\r\n";$subject = "Corporate RMA request form - ".$txtTicketNum;$body=$formData;echo "To: ".$to.$newLine;echo "From: ".$headers.$newLine;echo "Subject: ".$subject.$newLine.$newLine;echo "Body: ".$newLine.$body.$newLine;if (mail($to, $subject, $body, $headers)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); }//function end}//Send the completed formsendForm();?> Link to comment https://forums.phpfreaks.com/topic/18421-confused-help-php-data-to-html-table-to-be-sent-by-mail/ Share on other sites More sharing options...
hitman6003 Posted August 23, 2006 Share Posted August 23, 2006 You didn't ask a question. All you did was post some code. What is the problem? Where is the problem in your code? What have you tried to do to fix it? What are the events that cause the problem to occur? Link to comment https://forums.phpfreaks.com/topic/18421-confused-help-php-data-to-html-table-to-be-sent-by-mail/#findComment-79198 Share on other sites More sharing options...
lessthanthree Posted August 23, 2006 Share Posted August 23, 2006 I'm not really sure why you've specified a variable (incorrectly) for a new line in some places and used the proper newline / carriage return characters in others. You're also echoing your message headers to the screen and not actually putting them in a mail function.There's a couple of problems to get you going, fairly sure there'll be more but I just had a quick scan through and theyre the things that leapt out at me.Could you correct those, test and then provide a little more detail as to the problem you're getting as just posting some code with no further explanation doesn't give would-be helpers much info. Link to comment https://forums.phpfreaks.com/topic/18421-confused-help-php-data-to-html-table-to-be-sent-by-mail/#findComment-79200 Share on other sites More sharing options...
mikeweb Posted August 23, 2006 Author Share Posted August 23, 2006 sorry guys ... my message somehow got deleted...I'm having trouble getting my php variables to show up in the table that I'm trying to email using mail(). I've done alot of research on the web but no good clues. Any suggestionsp.s. newLine=<<br>> but doesn't show up in my post as it's html as well Link to comment https://forums.phpfreaks.com/topic/18421-confused-help-php-data-to-html-table-to-be-sent-by-mail/#findComment-79208 Share on other sites More sharing options...
lessthanthree Posted August 23, 2006 Share Posted August 23, 2006 [quote author=mikeweb link=topic=105339.msg420687#msg420687 date=1156343364]sorry guys ... my message somehow got deleted...I'm having trouble getting my php variables to show up in the table that I'm trying to email using mail(). I've done alot of research on the web but no good clues. Any suggestionsp.s. newLine=<<br>> but doesn't show up in my post as it's html as well[/quote]My bad, I think I misread a bit of the way your code works...teach me to scan too quickly...I'll have a deeper look (with a bit more care) Link to comment https://forums.phpfreaks.com/topic/18421-confused-help-php-data-to-html-table-to-be-sent-by-mail/#findComment-79226 Share on other sites More sharing options...
mikeweb Posted August 23, 2006 Author Share Posted August 23, 2006 not a problem lessthanthree :-)Seems to be a real challenge or it just can't be done.Just want my php vars to show up in the table i send via mail() ... sounds easy enough huh ? Link to comment https://forums.phpfreaks.com/topic/18421-confused-help-php-data-to-html-table-to-be-sent-by-mail/#findComment-79237 Share on other sites More sharing options...
mikeweb Posted August 23, 2006 Author Share Posted August 23, 2006 *Bumpmy vars show up as (for example) $txtDate ... instead of the date that was sentI just figured out to properly post my code. Here it is...[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>Corporate RMA Request Form - Submit Form</title><?phpfunction sendForm(){//form vars$newLine = "<br>";//populate vars from post$txtDate = $_POST["txtDate"];$SYSN["theDate"] = $_POST["txtDate"];$txtAgentName=$_POST["txtAgentName"];$txtBanNum=$_POST["txtBanNum"];$txtWirelessNum=$_POST["txtWirelessNum"];$txtCustomerName=$_POST["txtCustomerName"];$txtTicketNum=$_POST["txtTicketNum"];$txtContactName=$_POST["txtContactName"];$txtContactPhone=$_POST["txtContactPhone"];$txtContactEmail=$_POST["txtContactEmail"];$drpWirelessDevice=$_POST["drpWirelessDevice"];$txtPinNum=$_POST["txtPinNum"];$txtIMEI=$_POST["txtIMEI"];$txtSimNum=$_POST["txtSimNum"];$txtDefectNote=$_POST["txtDefectNote"];$txtShipAttentionTo=$_POST["txtShipAttentionTo"];$txtShipCompanyName=$_POST["txtShipCompanyName"];$txtShipAddress=$_POST["txtShipAddress"];$txtShipCity=$_POST["txtShipCity"];$txtShipProv=$_POST["txtShipProv"];$txtShipPostal=$_POST["txtShipPostal"];$formData='<table width="400" border="1" cellspacing="1" bordercolor="#D40139"> <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Corporate RMA Request form</span></b> </td> </tr> <tr> <td> Date: <?php= echo "$txtDate; ?><br> TicketNum <?php echo $txtTicketNum; ?> </td> <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Customer Information</span></b> </td> </tr> <tr> <td> Customer Information<br> Ban: <?php echo $txtBanNum; ?> txtWirelessNum <?php echo $txtWirelessNum; ?><br> txtCustomerName <?php echo $txtCustomerName; ?> </td> <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Contact Information</span></b> </td> </tr> <tr> <td> txtContactName <?php echo $txtContactName; ?> txtContactPhone <?php echo $txtContactPhone; ?><br> txtContactEmail <?php echo $txtContactEmail; ?> </td> </tr> <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Device Information</span></b> </td> </tr> <tr> <td> txtPinNum <?php echo $txtPinNum; ?> txtIMEI <?php echo $txtIMEI; ?><br> txtSimNum <?php echo $txtSimNum; ?> </td> </tr> <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Defect Information</span></b> </td> </tr> <tr> <td> <textarea name="txtDefectNote" cols="35" rows="6">"<?php echo $txtDefectNote ?>"</textarea> </td> </tr> <tr> <td width=300 valign=top bgcolor="#D40139"> <b><span style="font-size:9.0pt;color:white">Shipping Information</span></b> </td> </tr> <tr> <td> txtShipAttentionTo <?php echo $txtShipAttentionTo; ?><br> txtShipCompanyName <?php echo $txtShipCompanyName; ?><br> txtShipAddress <?php echo $txtShipAddress; ?><br> txtCityProvPostal <?php echo $txtShipCity; ?> </td> </tr></table>';//populate email varsecho $newLine;$to = "[email protected]";//$headers = "From: [email protected]";$headers = "From: [email protected]\r\nContent-type: text/html\r\n";$subject = "Corporate RMAA request form - ".$txtTicketNum;$body=$formData;echo "To: ".$to.$newLine;echo "From: ".$headers.$newLine;echo "Subject: ".$subject.$newLine.$newLine;echo "Body: ".$newLine.$body.$newLine;if (mail($to, $subject, $body, $headers)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); }}//function end//Send the completed formsendForm();?>[/code] Link to comment https://forums.phpfreaks.com/topic/18421-confused-help-php-data-to-html-table-to-be-sent-by-mail/#findComment-79280 Share on other sites More sharing options...
hitman6003 Posted August 23, 2006 Share Posted August 23, 2006 Change all of your vars in the email from <?php echo $varname; ?> to ' . $varname . ':[code]Customer Information<br> Ban: <?php echo $txtBanNum; ?> txtWirelessNum <?php echo $txtWirelessNum; ?><br> txtCustomerName <?php echo $txtCustomerName; ?>[/code]should be:[code]Customer Information<br> Ban: ' . $txtBanNum . ' txtWirelessNum ' . $txtWirelessNum . '<br> txtCustomerName ' . $txtCustomerName . '[/code] Link to comment https://forums.phpfreaks.com/topic/18421-confused-help-php-data-to-html-table-to-be-sent-by-mail/#findComment-79320 Share on other sites More sharing options...
mikeweb Posted August 23, 2006 Author Share Posted August 23, 2006 You are a champion and a scholar sir ! That worked just fine.I was down to one hair left on my head.THANK YOU ![quote author=hitman6003 link=topic=105339.msg420803#msg420803 date=1156350453]Change all of your vars in the email from <?php echo $varname; ?> to ' . $varname . ':[code]Customer Information<br> Ban: <?php echo $txtBanNum; ?> txtWirelessNum <?php echo $txtWirelessNum; ?><br> txtCustomerName <?php echo $txtCustomerName; ?>[/code]should be:[code]Customer Information<br> Ban: ' . $txtBanNum . ' txtWirelessNum ' . $txtWirelessNum . '<br> txtCustomerName ' . $txtCustomerName . '[/code][/quote] Link to comment https://forums.phpfreaks.com/topic/18421-confused-help-php-data-to-html-table-to-be-sent-by-mail/#findComment-79325 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.