max7
asked on
Limitations of php mail script output?
Hello Experts,
I am working on a webform to email using PHP. The script is capturing data from an online order form and sending via email to one recipient.
I had originally structured the email message with the form data to look like this:
Order one - Description: sweatpants, Color: black, Size: 78, 31, 100, 126, 50, 25, 652
Order two - Description: sweatpants, Color: ornge, Size: 78, 31, 100, 126, 50, 25, 652
Order three - Description: sweatpants, Color: ornge, Size: 78, 31, 100, 126, 50, 25, 652
Order four - Description: sweatpants, Color: ornge, Size: 78, 31, 100, 126, 50, 25, 652
Order five - Description: sweatpants, Color: ornge, Size: 78, 31, 100, 126, 50, 25, 652
Order six - Description: sweatpants, Color: ornge, Size: 78, 31, 100, 126, 50, 25, 652
New OS Client: no
Contact Info: Bob Smith, 123 Main Street, Waka, AK, Waka, 55555, bob@anyemail.com
Billing Info: Bob Smith,, 1234 Main Street, Waka, AK, 88888, bob@anyemail.com
Shipping Info: Bob Smith, 12345 Main Street, Waka, AK, 77777, bob@anyemail.com
Phone Numbers - Work: 719-270-5555, Mobile: 213-270-5555, Summer: 323-270-5555
Other comments: I am a new customer but not really ... I think you\'ve done some designs for me before so I wanted to contact you again and see if you guys still did business. Thanks and I hope to hear from you soon.
They don't like this organization so they've requested something like this:
Size qty size qyt size qyt size qty size qty size qty size qyt
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
tem Description Adult | xs s m l xl 2xl 3xl
Youth | s m l xl
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- --
Item Description Adult xs s m l xl 2xl 3xl
Youth s m l xl
I'm assuming I could do something like this in the email msg output area of the script (tell me if I'm wrong) but my question is: how far can go with this before it makes more sense to create a MySQL database and then grab information from there to output into in an email message or is there another way that would be a better choice which I haven't mentioned? My assumption is to produce the result they want, creating a database and then extracting this information from it would be ideal in this situation.
I am working on a webform to email using PHP. The script is capturing data from an online order form and sending via email to one recipient.
I had originally structured the email message with the form data to look like this:
Order one - Description: sweatpants, Color: black, Size: 78, 31, 100, 126, 50, 25, 652
Order two - Description: sweatpants, Color: ornge, Size: 78, 31, 100, 126, 50, 25, 652
Order three - Description: sweatpants, Color: ornge, Size: 78, 31, 100, 126, 50, 25, 652
Order four - Description: sweatpants, Color: ornge, Size: 78, 31, 100, 126, 50, 25, 652
Order five - Description: sweatpants, Color: ornge, Size: 78, 31, 100, 126, 50, 25, 652
Order six - Description: sweatpants, Color: ornge, Size: 78, 31, 100, 126, 50, 25, 652
New OS Client: no
Contact Info: Bob Smith, 123 Main Street, Waka, AK, Waka, 55555, bob@anyemail.com
Billing Info: Bob Smith,, 1234 Main Street, Waka, AK, 88888, bob@anyemail.com
Shipping Info: Bob Smith, 12345 Main Street, Waka, AK, 77777, bob@anyemail.com
Phone Numbers - Work: 719-270-5555, Mobile: 213-270-5555, Summer: 323-270-5555
Other comments: I am a new customer but not really ... I think you\'ve done some designs for me before so I wanted to contact you again and see if you guys still did business. Thanks and I hope to hear from you soon.
They don't like this organization so they've requested something like this:
Size qty size qyt size qyt size qty size qty size qty size qyt
--------------------------
tem Description Adult | xs s m l xl 2xl 3xl
Youth | s m l xl
--------------------------
Item Description Adult xs s m l xl 2xl 3xl
Youth s m l xl
I'm assuming I could do something like this in the email msg output area of the script (tell me if I'm wrong) but my question is: how far can go with this before it makes more sense to create a MySQL database and then grab information from there to output into in an email message or is there another way that would be a better choice which I haven't mentioned? My assumption is to produce the result they want, creating a database and then extracting this information from it would be ideal in this situation.
ASKER
>>>if you do not need that just crate an multidimensional array and iterate trough that
Pardon my ignorance, but what is a multidimensional array? Can you point me to a resource on how it works?
Pardon my ignorance, but what is a multidimensional array? Can you point me to a resource on how it works?
ASKER
and also what sort of results using such an array would produce ... I just got an email forwarded to me showing me what they had before it almost looks like a screenshot of the webform itself (just the form field elements as they would appear on the website but without colors or styles). Is this what a multidimensional array would produce?
here you can see the php manual with the array section
http://www.php.net/manual/en/language.types.array.php
in an array you can store data like this
$items[]=array("descriptio n"=>'sweat pants', 'color'=>'Black', 'size'=>'78, 31, 100, 126, 50, 25, 652');
$items[]=array("descriptio n"=>'sweat pants', 'color'=>'ornge', 'size'=>'78, 31, 100, 126, 50, 25, 652');
.......
foreach ($item as $orderno => $values){
echo"<br>Order $orderno";
echo "<br>Description".$values[ 'descripti on'];
echo "<br>Color".$values['color '];
echo "<br>Sizer".$values['size' ];
}
Hope this helps
http://www.php.net/manual/en/language.types.array.php
in an array you can store data like this
$items[]=array("descriptio
$items[]=array("descriptio
.......
foreach ($item as $orderno => $values){
echo"<br>Order $orderno";
echo "<br>Description".$values[
echo "<br>Color".$values['color
echo "<br>Sizer".$values['size'
}
Hope this helps
the multidimensional array it's used to store and manipulate the data easily. the layout and the way the data it's presented it's a diferent story.
please post the screenshot and maybe i can further asist you
please post the screenshot and maybe i can further asist you
ASKER
>>>please post the screenshot and maybe i can further asist you
The image attached is of an email generated with the webform data from their site. As you can see, the output is a two dimensional table that duplicates pretty much how the webform looks, except for colors or styles.
Would I be able to do this via email by altering my php script? If so, how time consuming would this be?
web-form-email-output.jpg
The image attached is of an email generated with the webform data from their site. As you can see, the output is a two dimensional table that duplicates pretty much how the webform looks, except for colors or styles.
Would I be able to do this via email by altering my php script? If so, how time consuming would this be?
web-form-email-output.jpg
how do you get all the variables? in a $_POST variable?
why you do not make a table and insert all the values in to the coresponding cells?
the form has some limitations - as you can see for longer strings the text it's trimmed
hope this helps
why you do not make a table and insert all the values in to the coresponding cells?
the form has some limitations - as you can see for longer strings the text it's trimmed
hope this helps
ASKER
>>> how do you get all the variables? in a $_POST variable?
Since this was created by some one else, I can't answer that. Would it make sense to you to do such thing a using POST or GET? I'm thinking POST ....
>>>why you do not make a table and insert all the values in to the coresponding cells?
Are you saying to make a table in my $msg output that basically recreates the webform tables? If not, can you clarify this?
>>>the form has some limitations - as you can see for longer strings the text it's trimmed
Good point and I will mention this to the person. Even if I were to create such an email output, it seems this aspect alone would be a deal killer in IMO.
Since this was created by some one else, I can't answer that. Would it make sense to you to do such thing a using POST or GET? I'm thinking POST ....
>>>why you do not make a table and insert all the values in to the coresponding cells?
Are you saying to make a table in my $msg output that basically recreates the webform tables? If not, can you clarify this?
>>>the form has some limitations - as you can see for longer strings the text it's trimmed
Good point and I will mention this to the person. Even if I were to create such an email output, it seems this aspect alone would be a deal killer in IMO.
>>> Are you saying to make a table in my $msg output that basically recreates the webform tables
Yes
try to figure out what variables are you geting and then try to insert them in the table
you can view the post data with this script placed at the begining of your script
echo"<pre>";
print_r($_POST);
echo"</pre>";
hope this helps
Yes
try to figure out what variables are you geting and then try to insert them in the table
you can view the post data with this script placed at the begining of your script
echo"<pre>";
print_r($_POST);
echo"</pre>";
hope this helps
ASKER
>>>try to figure out what variables are you geting and then try to insert them in the table
I know all the possible variables and those are already in place on the form. Thing is, I need to set this form up and have the variable ready to catch the data as the user inputs it. Perhaps I'm misunderstanding you here but it wouldn't be workable to try and figure out what variables any one user choose to enter on this form. I need to be able to set it and foget it and have it send the email if you know what i mean.
Regarding recreating the webform tables in my $msg output area, what is the best way to go about this? If I output markup (xhtml) how would I set it this so the script sends an email in html format so the mark up renders correctly?
I know all the possible variables and those are already in place on the form. Thing is, I need to set this form up and have the variable ready to catch the data as the user inputs it. Perhaps I'm misunderstanding you here but it wouldn't be workable to try and figure out what variables any one user choose to enter on this form. I need to be able to set it and foget it and have it send the email if you know what i mean.
Regarding recreating the webform tables in my $msg output area, what is the best way to go about this? If I output markup (xhtml) how would I set it this so the script sends an email in html format so the mark up renders correctly?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That did it ... thanks!
if you do not need that just crate an multidimensional array and iterate trough that
i hope this helps