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?
9 1898 kovik 1,044
Recognized Expert Top Contributor
What do you mean? There is no display at all? Show us some code.
The field I am interested in is called "totalMonthlyAmount," which contains the value "$131.00." -
-
$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>
-
-
United Brokers";
kovik 1,044
Recognized Expert Top Contributor
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.
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; -
$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);
-
-
?>
-
kovik 1,044
Recognized Expert Top Contributor
Again, print out the raw information using print_r and tell me what you get.
I am very new to PHP so I have no idea how to do what you are asking.
kovik 1,044
Recognized Expert Top Contributor
print_r() is a function. I linked it in an earlier post for you. It outputs the contents of an array.
Here is my 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
-
-
?>
-
and this is the resulting string:
Dida Taylorandersond@ubinc.comdidat@ubinc.com5.0002/01/2010
Thank you for your help and your patience. Using your suggestion (print_r) I figured out the problem. Without your help I would have pulled out my hair.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: David Casey |
last post by:
I'm working on a program for my C++ class and have it all written and
working except for one part. I need to compare two numeric variables to
determine decimal accuracy between them. For example:...
|
by: christopher.secord |
last post by:
I have a table containing typed log entries. One log entry is supposed
to be created every twelve hours, but sometimes there are gaps. I need
to create a report showing the time of entry, and the...
|
by: greenflame |
last post by:
How can I tell if a variable. I want ot tell whether two variables are:
1. Both numbers. Just a number. same as the number object in
javascript.
2. Either one is a string containing a number....
|
by: Joriveek |
last post by:
I have a float variable like 123456789
I want to right truncate this and only display say only 8 right most values
all the time or otherwise filled by zeros if it is less than 8 digits, do
you...
|
by: Kosio |
last post by:
Hello,
I know of a way to extract digits from a number using the %10 and
divide by 10. But I am wondering if there is an algorithm out there
that does not use a divide by 10 feature.
The...
|
by: Joe Molloy |
last post by:
Hi,
This isn't a mission critical question but I thought I'dl throw it out there
for your feedback as it's a bit curious.
I have developed a shopping cart for an application I'm working on...
|
by: MLH |
last post by:
120 MyString = "How many copies of each letter do you need?"
150 MyVariant = InputBox(MyString, "How Many?", "3")
If MyVariant = "2" Then MsgBox "MyVariant equals the string '2'"
If...
|
by: John_H |
last post by:
Re: ASP.NET 2.0
I would like suggestions or code examples on how to collect a variable
length list of input data (item# & item quantity specifically).
I thought that I could accomplish this...
|
by: garyusenet |
last post by:
I'm trying to investigate the maximum size of different variable types.
I'm using INT as my starting variable for exploration. I know that the
maximum number that the int variable can take is:...
|
by: jlt206 |
last post by:
This code <?php include("counter.php")?> on the webpage produces the count number. (function code below)
I want to place the current number into a variable $MemberNo or into a FormField to be sent...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |