issue with mail function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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\n<html><body><table 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}<br><img src='
   http://lpacmarketing.hostzi.com/images/spacer.gif' width='120' height='1'
   ></td>";
   22. }
   23.
   24.
   25. $body .= "</tr><tr valign='top'>";
   26.
   27. foreach ($fields2 as $x => $y)
   28. $body .= "<td>{$y}</td>";
   29.
   30. $body .= "</tr><tr valign='top'>";
   31.
   32. foreach ($fields2 as $x => $y)
   33. $body .= "<td>{$_REQUEST[$x]}</td>";
   34.
   35. $body .= "</tr><tr valign='top'><td colspan='9'>";
   36.
   37. foreach ($fields as $a => $b) {
   38. $body .= sprintf("%s\n",$b);
   39. }
   40.
   41. $body .= "<br><br>";
   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.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux