akabir77 Posted July 6, 2007 Share Posted July 6, 2007 Hi i am brand new in PHP. I am working on this Application Form which is suppose to email me the content in HTML. It works fine but not all the way. what i mean is not all the data shows up correctly. If you look at the following out put. you will see the last name got an ! sign which was not from the input form. A new Job Application has been submitted on 07/06/2007 12:17:47 PM Uni-Guard Security is an Equal Oppertunity EmployerAPPLICATION FOR EMPLOYMENT Full Time: 40 Part Time: 40 Position Desired: Security Guard Days/Hours Availabble: All Answer all question completely- Please print Date: 7/15/2007 Email: akabir@bgserve.com Phone: (816)4101118 ext 1336 Name Last: Robe! r First: Fake Middle: x Address Number: 11666 Street: West Christi Lane City: Raymore State: MO Zip: 64083 .... Please can someone tell me why its happning? Here is my code <?php // URL of script: http://www.blazonry.com/scripting/phpmail.php // if submitted form process and send mail if ($_SERVER['REQUEST_METHOD'] == "POST") { // just to be safe I strip out HTML tags $strFullTime = strip_tags(trim($_POST["FullTime"])); $strPartTime = strip_tags(trim($_POST["PartTime"])); $strPositionDesired = strip_tags(trim($_POST["PositionDesired"])); $strDaysHoursAvailable = strip_tags(trim($_POST["DaysHoursAvailable"])); $strDate = strip_tags(trim($_POST["Date"])); $strEmail = strip_tags(trim($_POST["Email"])); $strPhone = strip_tags(trim($_POST["Phone"])); $strLastName = strip_tags(trim($_POST["LastName"])); $strFirstName = strip_tags(trim($_POST["FirstName"])); $strMidName = strip_tags(trim($_POST["MidName"])); $strNumb = strip_tags(trim($_POST["Numb"])); $strStreet = strip_tags(trim($_POST["Street"])); $strCity = strip_tags(trim($_POST["City"])); $strState = strip_tags(trim($_POST["State"])); $strZip = strip_tags(trim($_POST["Zip"])); $strSS = strip_tags(trim($_POST["SS"])); $strDL = strip_tags(trim($_POST["DL"])); $strDLState = strip_tags(trim($_POST["DLState"])); $strEName = strip_tags(trim($_POST["EName"])); $strEPhn = strip_tags(trim($_POST["EPhn"])); $strERel = strip_tags(trim($_POST["ERel"])); $strGED = strip_tags(trim($_POST["GED"])); $strRform = strip_tags(trim($_POST["Rform"])); $str18 = strip_tags(trim($_POST["18"])); $strRef = strip_tags(trim($_POST["Ref"])); $strEL = strip_tags(trim($_POST["EL"])); $strCrime = strip_tags(trim($_POST["Crime"])); $strComments = strip_tags(trim($_POST["crime"])); $strMailFrom = "info@bgserve.com"; $strMailTo = "akabir@bgserve.com"; $strMailCC = ""; $strMailBCC = ""; $strHTML = "on"; // "on" OR "off" $strSubject = "A New Job Application"; $strMailBody .= "A new Job Application has been submitted on ". date("m/d/Y g:i:s A") ."<br><br>"; $strMailBody .= "<font size=\"1\">Uni-Guard Security is an Equal Oppertunity Employer</font>"; $strMailBody .= "<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"760\" bgcolor=\"#000000\">"; $strMailBody .= "<tr bgcolor=\"#efefef\"><td colspan=\"8\" align=\"center\"><strong>APPLICATION FOR EMPLOYMENT</strong></td></tr>"; $strMailBody .= "<tr bgcolor=\"#ffffff\"><td>Full Time:</td><td>".$strFullTime."</td><td>Part Time:</td><td>".$strPartTime."</td><td>Position Desired:</td><td>".$strPositionDesired."</td><td>Days/Hours Availabble:</td><td>".$strDaysHoursAvailable."</td></tr>"; $strMailBody .= "</table><br>"; $strMailBody .= "<font size=\"1\">Answer all question completely- Please print</font>"; $strMailBody .= "<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"760\" bgcolor=\"#000000\">"; $strMailBody .= "<tr bgcolor=\"#ffffff\"><td><strong>Date: </strong>".$strDate."</td><td colspan=\"2\"><strong>Email: </strong>".$strEmail."</td><td colspan=\"2\"><strong>Phone: </strong>".$strPhone."</td></tr>"; $strMailBody .= "<tr bgcolor=\"#ffffff\"><td colspan=\"5\"><strong>Name</strong></td></tr>"; $strMailBody .= "<tr bgcolor=\"#ffffff\"><td><strong>Last: </strong>".$strLastName."</td><td colspan=\"2\"><strong>First: </strong>".$strFirstName."</td><td colspan=\"2\"><strong>Middle: </strong>".$strMidName."</td></tr>"; $strMailBody .= "<tr bgcolor=\"#ffffff\"><td colspan=\"5\"><strong>Address</strong></td></tr>"; $strMailBody .= "<tr bgcolor=\"#ffffff\"><td><strong>Number: </strong>".$strNumb."</td><td><strong>Street: </strong>".$strStreet."</td><td><strong>City: </strong>".$strCity."</td><td><strong>State: </strong>".$strState."</td><td><strong>Zip: </strong>".$strZip."</td></tr>"; $strMailBody .= "<tr bgcolor=\"#ffffff\"><td><strong>Social Security# </strong>".$strSS."</td><td colspan=\"2\"><strong>Driver's License: </strong>".$strDL."</td><td colspan=\"2\"><strong>State: </strong>".$strDLState."</td></tr>"; $strMailBody .= "<tr bgcolor=\"#ffffff\"><td align=\"left\"><strong>Social Security#</strong>".$strSS."</td><td align=\"center\" colspan=\"2\"><strong>Driver's License:</strong>".$strDL."</td><td align=\"right\" colspan=\"2\"><strong>State:</strong>".$strDLState."</td></tr>"; $strMailBody .= "<tr bgcolor=\"#ffffff\"><td colspan=\"3\"><strong>Do you have a high school deiploma/GED?: </strong>".$strGED."</td><td align=\"right\" colspan=\"2\"><strong>Received form: </strong>".$strRform."</td></tr>"; $strMailBody .= "</table><br>"; // Set the headers for our e-mail message. $strMailHeaders .= "MIME-Version: 1.0\n"; if ($strHTML != "on") { // The user does not want to send the e-mail in HTML format, so we must get // rid of the HTML in the message. $strMailBody = htmlspecialchars ($strMailBody); $strMailHeaders .= "Content-type: text/plain; charset=iso-8859-1\n"; } else { $strMailHeaders .= "Content-type: text/html; charset=iso-8859-1\n"; } // Set the Additional Headers $strMailHeaders .= "From:$strMailFrom\r\n"; $strMailHeaders .= "Cc:$strMailCC\r\n"; $strMailHeaders .= "Bcc:$strMailBCC"; // send the email mail($strMailTo, $strSubject, $strMailBody, $strMailHeaders); } ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Uni-Guard - Contact Us</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> <!-- @import url("./uniguard.css"); --> </style> <!--[if IE 6]> <link href="./ie6.css" media="screen" rel="stylesheet" type="text/css" /> <![endif]--> <link href="./print.css" media="print" rel="stylesheet" type="text/css" /> </head> <body> <div class="lsidebar"> <div id="menu"> <ul id="links"> <li id="homelink"><a href="./index.htm"></a></li> <li id="aboutlink"><a href="./about.htm"></a></li> <li id="execlink"><a href="./exec.htm"></a></li> <li id="emplink"><a href="./emp.htm"></a></li> <li id="trainlink"><a href="./train.htm"></a></li> <li id="risklink"><a href="./risk.htm"></a></li> <li id="safelink"><a href="./safe.htm"></a></li> <li id="contactlink"><a href="./contact.htm"></a></li> </ul> </div> </div> <div class="page"> <div class="header"> <img alt="Contact Us Header Picture" src="./images/conthead.gif" width="575" height="149" /> </div> <div class="content"> <!-- Start of Page Content --> <table border="0" width="90%"> <tr> <td > <?php if ($_SERVER['REQUEST_METHOD'] == "POST") { echo("<p>Thank you <b>".$strFirstName." ".$strLastName."</b> for Applying to UNI-GUARD. somebody from HR will be contacting you soon.</p>\n"); echo("<blockquote><pre>\n"); echo($strFeedback); echo("</pre></blockquote>"); } else { ?> <!-- *** START HTML FORM --> <div id="form1"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD="POST"> <font size="1">Uni-Guard Security is an Equal Oppertunity Employer</font> <table id="appTable"> <tr> <td colspan="4" align="center"> <h1><u>APPLICATION FOR EMPLOYMENT</u></h1> </td> <tr> <td align="left"> Full Time:<input name="FullTime" type="text" size="4" /> </td> <td align="center"> Part Time:<input name="PartTime" type="text" size="4" /> </td> <td align="center"> Position Desired:<input name="PositionDesired" type="text" size="20" /> </td> <td align="right"> Days/Hours Available:<input name="DaysHoursAvailable" type="text" size="12" /> </td> </tr> </table><br /> <font size="1">Answer all question completely- Please print</font> <table id="appTable"> <tr> <td> <table id="fillTable"> <tr> <td width="32%" align="left"> Date:<input name="Date" type="text" size="10" /> </td> <td width="33%" align="center"> Email:<input name="Email" type="text" size="20" /> </td> <td width="32%" align="right"> Phone:<input name="Phone" type="text" size="10" /> </td> </tr> </table> </td> </tr> <tr> <td align="left"> <strong>Name</strong> </td> <tr> <td align="left"> <table id="fillTable"> <tr> <td width="32%" align="left"> Last: <input name="LastName" type="text" size="25" /> </td> <td width="33%" align="center"> First: <input name="FirstName" type="text" size="25" /> </td> <td width="32%" align="right"> Middle: <input name="MidName" type="text" size="25" /> </td> </tr> </table> </td> </tr> <tr> <td align="left"> <strong>Address</strong> </td> <tr> <td align="left"> <table id="fillTable"> <tr> <td width="20%" align="left"> Number: <input name="Numb" type="text" size="10" /> </td> <td width="20%" align="center"> Street: <input name="Street" type="text" size="10" /> </td> <td width="20%" align="right"> City: <input name="City" type="text" size="10" /> </td> <td width="20%" align="center"> State: <input name="State" type="text" size="1" /> </td> <td width="20%" align="right"> Zip Code: <input name="Zip" type="text" size="8" /> </td> </tr> </table> </td> </tr> <tr> <td align="left"> <table id="fillTable"> <tr> <td width="32%" align="left"> Social Security: <input name="SS" type="text" size="12" /> </td> <td width="33%" align="center"> Driver's License: <input name="DL" type="text" size="12" /> </td> <td width="32%" align="right"> State: <input name="DLState" type="text" size="15" /> </td> </tr> </table> </td> </tr> <tr> <td align="left"> <strong>Emergency Contact Information</strong> </td> <tr> <tr> <td align="left"> <table id="fillTable"> <tr> <td width="32%" align="left"> Name: <input name="EName" type="text" size="12" /> </td> <td width="33%" align="center"> Phone# <input name="EPhn" type="text" size="12" /> </td> <td width="32%" align="right"> Relationship: <input name="ERel" type="text" size="15" /> </td> </tr> </table> </td> </tr> <tr> <td align="left"> <table id="fillTable"> <tr> <td width="60%" align="left"> Do you have a high school diploma/GED? <input name="GED" type="text" size="30" /> </td> <td width="40%" align="right"> Received form? <input name="Rform" type="text" size="20" /> </td> </tr> </table> </td> </tr> <tr> <td align="left" align="left"> Are you at least 18 years old? <input name="18" type="radio" value="Yes"/> <input name="18" type="radio" value="No"/> reffered by whom? <input name="Ref" type="text" size="30" /> </td> </tr> <tr> <td align="left"> <table id="fillTable"> <tr> <td width="50%" align="left"> Are you able to read, write and understand English language? </td> <td width="50%" align="right"> <input name="EL" type="text" size="65"/> </td> </tr> </table> </td> </tr> <tr> <td align="left"> Have you ever been convicted of a crime? <input name="Crime" type="radio" value="Yes"/> <input name="Crime" type="radio" value="No"/> (A Yes answer does not neccessarily exclude you from consideration) </td> </tr> <tr> <td> <table id="fillTable"> <tr> <td width="40%"> If yes, please explain; provide dates, location and circumstances? </td> <td width="60%" align="right"> <textarea name="Comments" rows="2" cols="55" wrap="physical"></textarea> </td> </tr> </table> </td> </tr> </table><br /> <table cellpadding="4" cellspacing="0" border="0" align="center"> <tr><td colspan="2" align="right"><input type="submit" value="Submit Application"></td></tr> </table> </form> </div> <?php } ?> </td> </tr> </table> <!-- End of Page Content --> </div> <div class="footer"> Copyright © <a href="http://www.uni-guard.com">Uni-Guard Security Services</a> 2005,All Rights Reserved <br/> <table width="100%" border="0"> <tr> <td> <!-- blank --> </td> <td align="right">Designed by<a href="http://www.newtdesigns.com/"><img id="dblink" alt="Newt Designs" src="http://www.newtdesigns.com/images/link1.jpg" width="51" height="45" /></a> </td></tr> </table> </div> </div> <!-- *** END HTML FORM --> </body> </html> Quote Link to comment Share on other sites More sharing options...
mpharo Posted July 6, 2007 Share Posted July 6, 2007 Im just shooting in the dark here.... <![endif]--> Do an echo of $strLastName and see if it is displayed on the page....if it is not on the page it is being added in the header or body of the e-mail message. Quote Link to comment Share on other sites More sharing options...
soycharliente Posted July 6, 2007 Share Posted July 6, 2007 A proper HTML comment does start with <!-- Though I don't know if that's the cause either. You should just not use a separate CSS file to "handle" IE6. You can write CSS styles that will work for all browsers. Quote Link to comment Share on other sites More sharing options...
akabir77 Posted July 6, 2007 Author Share Posted July 6, 2007 So far I narrowed down to the email software problem which can't wrap stuff. Now the problem is how do i solve it. I used a \n after the first line which took care of the Last Name issue but Since my result will be a big table after few lines that ! comes back If i do a view source on my emai i get this: <strong>State: </stron! g>Missouri</td> Where you can see its putting that ! sign and I am thinking its becuse outlook goes to 2nd line or something... Can anyone tell me how to solve this. I want to force \n after each </td> but if i put \n the page doesn't work... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.