I am haviing a problem getting fields from a datatable to display if they contain digits, like 5.00 or $25.00. My php page will display any other variables without any problems. How can I get these fields that contain digits to display?
How can I get a variable containing digits to display?
Collapse
X
-
The field I am interested in is called "totalMonthlyAm ount," which contains the value "$131.00."
United Brokers";Code:$paymentamount = $_REQUEST['totalMonthlyAmount']; $subject = "RE: $insured - submission received:"; $body = "United Brokers has received data from the Occupational Accident application you submitted on <b><u>$insured</u></b> asking that it be bound. Your underwriter, $underwriter, will review it and contact you in one business day or less if more information is needed. Then, when your signed application and Agent Disclaimer, along with the first payment of $paymentamount, have been received your underwriter will forward them to the carrier and send you a binder.<br><br>It is always a pleasure to do business with you.<br><br>
Comment
-
You do realize that the "$_REQUEST" superglobal array and the database are two different things, right? Secondly, try using print_r on $_REQUEST to see what data is in it.
Personally, I recommend against using $_REQUEST. $_REQUEST allows certain request methods to overwrite others, giving unpredictable results.Comment
-
Yes. I do realize that the fields from the database have been sent in an associative array. And, I have no problem displaying field values that do not start with a digit or a "$". Here is the entire file;
Code:$fromname = $_REQUEST['underwriter']; $underwriter = $_REQUEST['underwriter']; $underwriter1email = $_REQUEST['underwriterEmail']; $agent = $_REQUEST['Agent']; $producer = $_REQUEST['Producer']; $insured = $_REQUEST['ownerOperatorName']; $paymentamount = $_GET['totalMonthlyAmount']; $subject1 = "RE: $insured - submission received:"; $subject2 = "RE: Occ Acc submission on $insured:"; $body1 = "United Brokers has received data from the Occupational Accident application you submitted on <b><u>$insured</u></b> asking that it be bound. Your underwriter, $underwriter, will review it and contact you in one business day or less if more information is needed. Then, when your signed application and Agent Disclaimer, along with the first payment of $paymentamount, have been received your underwriter will forward them to the carrier and send you a binder.<br><br>It is always a pleasure to do business with you.<br><br> United Brokers"; $body2 = "$producer, of $agent, has submitted an Occ Acc application on <b><u>$insured</u></b> and requested that it be bound. Please review the application and contact the producer in one business day or less if more information is needed. Otherwise be prepared to submit it to the insurance carrier when the signed application and Agent Disclaimer, along with $paymentamount, have been received."; $eol="\r\n"; $attachments=false; $mime_boundary=md5(time()); # Common Headers $headers .= "From: ".$fromname."<".$fromaddress.">".$eol; $headers .= "Reply-To: ".$fromname."<".$fromaddress.">".$eol; $headers .= "Return-Path: ".$fromname."<".$fromaddress.">".$eol; // these two to set reply address $headers .= "Message-ID: <".time()."-".$fromaddress.">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; // These two to help avoid spam-filters # Boundry for marking the split & Multitype Headers $headers .= 'MIME-Version: 1.0'.$eol.$eol; $headers .= "Content-Type: multipart/mixed; boundary=\"".$mime_boundary."\"".$eol.$eol; # Open the first part of the mail email1 $msg1 = "--".$mime_boundary.$eol; $htmlalt_mime_boundary = $mime_boundary."_htmlalt"; //we must define a different MIME boundary for this section # Setup for text OR html - $msg1 .= "Content-Type: multipart/alternative; boundary=\"".$htmlalt_mime_boundary."\"".$eol.$eol; # Text Version $msg1 .= "--".$htmlalt_mime_boundary.$eol; $msg1 .= "Content-Type: text/plain; charset=iso-8859-1".$eol; $msg1 .= "Content-Transfer-Encoding: 8bit".$eol.$eol; $msg1 .= strip_tags(str_replace("<br>", "\n", substr($body, (strpos($body, "<body>")+6)))).$eol.$eol; # HTML Version $msg1 .= "--".$htmlalt_mime_boundary.$eol; $msg1 .= "Content-Type: text/html; charset=iso-8859-1".$eol; $msg1 .= "Content-Transfer-Encoding: 8bit".$eol.$eol; $msg1 .= $body1.$eol.$eol; //close the html/plain text alternate portion $msg1 .= "--".$htmlalt_mime_boundary."--".$eol.$eol; # Open the first part of the mail email2 $msg2 = "--".$mime_boundary.$eol; $htmlalt_mime_boundary = $mime_boundary."_htmlalt"; //we must define a different MIME boundary for this section # Setup for text OR html - $msg2 .= "Content-Type: multipart/alternative; boundary=\"".$htmlalt_mime_boundary."\"".$eol.$eol; # Text Version $msg2 .= "--".$htmlalt_mime_boundary.$eol; $msg2 .= "Content-Type: text/plain; charset=iso-8859-1".$eol; $msg2 .= "Content-Transfer-Encoding: 8bit".$eol.$eol; $msg2 .= strip_tags(str_replace("<br>", "\n", substr($body, (strpos($body, "<body>")+6)))).$eol.$eol; # HTML Version $msg2 .= "--".$htmlalt_mime_boundary.$eol; $msg2 .= "Content-Type: text/html; charset=iso-8859-1".$eol; $msg2 .= "Content-Transfer-Encoding: 8bit".$eol.$eol; $msg2 .= $body2.$eol.$eol; //close the html/plain text alternate portion $msg2 .= "--".$htmlalt_mime_boundary."--".$eol.$eol; if ($attachments !== false) { for($i=0; $i < count($attachments); $i++) { if (is_file($attachments[$i]["file"])) { # File for Attachment $file_name = substr($attachments[$i]["file"], (strrpos($attachments[$i]["file"], "/")+1)); $handle=fopen($attachments[$i]["file"], 'rb'); $f_contents=fread($handle, filesize($attachments[$i]["file"])); $f_contents=chunk_split(base64_encode($f_contents)); //Encode The Data For Transition using base64_encode(); $f_type=filetype($attachments[$i]["file"]); fclose($handle); # Attachment email1 $msg1 .= "--".$mime_boundary.$eol; $msg1 .= "Content-Type: ".$attachments[$i]["content_type"]."; name=\"".$file_name."\"".$eol; // sometimes i have to send MS Word, use 'msword' instead of 'pdf' $msg1 .= "Content-Transfer-Encoding: base64".$eol; $msg1 .= "Content-Description: ".$file_name.$eol; $msg1 .= "Content-Disposition: attachment; filename=\"".$file_name."\"".$eol.$eol; // !! This line needs TWO end of lines !! IMPORTANT !! $msg1 .= $f_contents.$eol.$eol; # Attachment email2 $msg2 .= "--".$mime_boundary.$eol; $msg2 .= "Content-Type: ".$attachments[$i]["content_type"]."; name=\"".$file_name."\"".$eol; // sometimes i have to send MS Word, use 'msword' instead of 'pdf' $msg2 .= "Content-Transfer-Encoding: base64".$eol; $msg2 .= "Content-Description: ".$file_name.$eol; $msg2 .= "Content-Disposition: attachment; filename=\"".$file_name."\"".$eol.$eol; // !! This line needs TWO end of lines !! IMPORTANT !! $msg2 .= $f_contents.$eol.$eol; } } } # Finished $msg1 .= "--".$mime_boundary."--".$eol.$eol; // finish with two eol's for better security. see Injection. $msg2 .= "--".$mime_boundary."--".$eol.$eol; # SEND THE EMAIL ini_set(sendmail_from,$fromaddress); // the INI lines are to force the From Address to be used ! $mail_sent1 = mail($to1, $subject1, $msg1, $headers); sleep(1); $mail_sent2 = mail($to2, $subject2, $msg2, $headers); ini_restore(sendmail_from); ?>Comment
-
Here is my code:
and this is the resulting string:Code:<?php print_r($_REQUEST['underwriter']); //Dida Taylor print_r($_REQUEST['ProducerEmail']); //andersond@ubinc.com print_r($_REQUEST['underwriterEmail']); //didat@ubinc.com print_r($_REQUEST['monthlyPremium']); //$125.00 print_r($_REQUEST['nonOccAccPremium']); //5.00 print_r($_REQUEST['associationFee']); //5.00 print_r($_REQUEST['totalMonthlyAmount']); //$135.00 print_r($_REQUEST['effectiveDate']); //02/01/2010 ?>
Dida Taylorandersond @ubinc.comdidat @ubinc.com5.0002/01/2010Comment
Comment