[PHP] issue with mail function

2009-08-04 Thread 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:

[code]


   1. ?php
   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\nhtmlbodytable cellspacing='2' cellpadding='2'border=
   '1'tr valign='top';
   13.
   14.
   15. //FOREACH LOOP
   16.
   17. $headerlabel = '0';
   18.
   19. foreach ($fields as $x = $y) {
   20. $headerlabel = $headerlabel +1;
   21. $body .= td{$headerlabel}brimg src='
   http://lpacmarketing.hostzi.com/images/spacer.gif' width='120' height='1'
   /td;
   22. }
   23.
   24.
   25. $body .= /trtr valign='top';
   26.
   27. foreach ($fields2 as $x = $y)
   28. $body .= td{$y}/td;
   29.
   30. $body .= /trtr valign='top';
   31.
   32. foreach ($fields2 as $x = $y)
   33. $body .= td{$_REQUEST[$x]}/td;
   34.
   35. $body .= /trtr valign='top'td colspan='9';
   36.
   37. foreach ($fields as $a = $b) {
   38. $body .= sprintf(%s\n,$b);
   39. }
   40.
   41. $body .= brbr;
   42.
   43. foreach ($fields as $a = $b) {
   44. $body .= sprintf(%s\n,$_POST[$a]);
   45. }
   46.
   47. $body .= /td/tr/table/body/html;
   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.


RE: [PHP] issue with mail function

2009-08-04 Thread 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