issue with mail function

issue with mail function

am 04.08.2009 17:43:35 von Allen McCabe

--001636427659daeca0047052bfe3
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

I have recently been working a lot lately with arrays and printing them into
html tables for email (like a user survey for example). I have been seeing
odd things with the table lately, each unique to it's sending php file. I
will get a space in a random spot. In one, I used an array to rename the
Name values of input fields to more readable ones, "whatadd" becomes "What
to Add", only the word 'Add' is spelled 'Ad d'. With my recent mail script
(submitting a customer profile change), I get it in a similar area, a Name
value renamed and I get "Emp loyee" in the table cell. The adjacent cell is
fine though, reading "Needs Handicap Accommodations". I will post some of my
code to show that I haven't misplaced a space:

[code]


1. 2.
3. //CHECKS TO SEE IF FIELDS WERE PROPERLY COMPLETED AND ASSIGNS
VARIABLES TO INPUTS - OTHERWISE AN ERROR MESSAGE IS PRINTED
4.
5. $Employee = $_POST['Employee'];
6.
7. $fields2 = array();
8.
9. $fields2{"Employee"} = "Employee";
10. $fields2{"IsHandicappedAccommodations"} = "Needs Handicap
Accommodations";
11.
12. $body = "We have received the following
information:\n\n

'1'>";
13.
14.
15. //FOREACH LOOP
16.
17. $headerlabel = '0';
18.
19. foreach ($fields as $x => $y) {
20. $headerlabel = $headerlabel +1;
21. $body .= "";
22. }
23.
24.
25. $body .= "";
26.
27. foreach ($fields2 as $x => $y)
28. $body .= "";
29.
30. $body .= "";
31.
32. foreach ($fields2 as $x => $y)
33. $body .= "";
34.
35. $body .= "
{$headerlabel}
>
{$y}
{$_REQUEST[$x]}
";
36.
37. foreach ($fields as $a => $b) {
38. $body .= sprintf("%s\n",$b);
39. }
40.
41. $body .= "

";
42.
43. foreach ($fields as $a => $b) {
44. $body .= sprintf("%s\n",$_POST[$a]);
45. }
46.
47. $body .= "
";
48.
49. //END FOREACH LOOPS

[/code]

This is all the code I think is really relevant, but if you think I left
something out I'll be happy to share with you all the code.

This is not a major issue for me, it is just so strange, and if someone
could provide some insight, it would be great.

--001636427659daeca0047052bfe3--

RE: issue with mail function

am 04.08.2009 17:50:04 von Bob McConnell

From: Allen McCabe

> I have recently been working a lot lately with arrays and printing
them into
> html tables for email (like a user survey for example). I have been
seeing
> odd things with the table lately, each unique to it's sending php
file. I
> will get a space in a random spot. In one, I used an array to rename
the
> Name values of input fields to more readable ones, "whatadd" becomes
"What
> to Add", only the word 'Add' is spelled 'Ad d'. With my recent mail
script
> (submitting a customer profile change), I get it in a similar area, a
Name
> value renamed and I get "Emp loyee" in the table cell. The adjacent
cell is
> fine though, reading "Needs Handicap Accommodations". I will post some
of my
> code to show that I haven't misplaced a space:

How far apart are these spaces? Is something on your server injecting
new lines on lines of text it thinks are too long? This would be
displayed by the browser as a space. View source at the browser to see
what was actually added. If this is the case, I suspect you are running
on a Microsoft platform and forgot to set binary mode somewhere.

Bob McConnell

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php