MockY Posted October 4, 2007 Share Posted October 4, 2007 I am writing a bunch of forms that I am about to use on one of my websites. The first form is done, and I made sure that it works by duplicating it, name it test.php and used <form method="post" action="test.php"> so instead of the input boxes, I see what the user typed in. My goal is to email this instead of displaying it in another file, but I want it to look just like the form does as in test.php. So I figured I would just enclose the entire form in a variable, for example $message = " The entire form, including css"; and then use the $message variable in mail() and the receiver would then receive the form in html and it would look just like test.php I used escape before every " inside the form. But it seems like this wasn't as easy as I anticipated. Before I wanted to even try to use it with mail(), I wrapped the entire form in, what I earlier mentioned in a variable $message = " The entire form, including css"; and in the end just echo the variable. This should be pretty straight forward, but it doesn't work. I'll attach just a snipped out of the entire form, but remember, this is far from the entire form: $message = " <style> #content { background-color:#fff; width:580px; min-height:500px; height:auto !important; height:560px; float:left; margin-right:10px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:13px; } <div id=\"content\"> <form method=\"post\" action=\"test.php\"> <div id=\"formwrapper\"> <div id=\"areablue\"> <table border=\"0\"> <tr> <td rowspan=\"11\" class=\"number-q1\">1</td> <td colspan=\"4\"> </td> </tr> <tr> <td rowspan=\"9\"> </td> </tr> <tr> <td colspan=\"2\">Business Name </td> <td colspan=\"2\">Quote Needed By </td> </tr> <tr> <td colspan=\"2\"><div class=\"businessname-q1\"><?php echo $_POST['businessname']; ?></div></td> <td colspan=\"2\"><div class=\"quoteneed-q1\"><?php echo $_POST['quoteneededby']; ?></div></td> </tr> </table> </div> </div> </form> "; echo $message; ?> It works just fine for me without putting it into a variable, but with what I am trying to acomplish I get this error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING The line it is referring to is the first retrieval and there is too many ors for me to understand what's wrong <td colspan=\"2\"><div class=\"businessname-q1\"><?php echo $_POST['businessname']; ?></div></td> Why is this, and what am I missing? Quote Link to comment https://forums.phpfreaks.com/topic/71857-help-with-my-script-to-work-with-mail/ 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.