February 17, 201115 yr Hey guys, I have a form that is working, now all I am trying to do is make to emailed form look a little more attractive. I am trying to put the contents into a table as follows. <tr> <td width="100">Name</td> <td width="200"> <?php include(" . $_POST['field_1'] . "); ?></td> </tr> <tr> Can somebody tell me why this doesnt work and suggest an alternative? That would be great, Thanks!
February 17, 201115 yr Try... <tr> <td width="100">Name</td> <td width="200"> <input type="text" name="field_1" value="<?php echo $_POST['field_1']; ?>" /></td> </tr> <tr> * note, this is just to get your php working. Edited February 17, 201115 yr by Mollart
February 17, 201115 yr Author This is the original code and i am just trying to put the " . $_POST['field_1'] . " parts of the code into the table. Can i modify the below in anyway to include styling? <?php $where_form_is="h.t.t.p://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/")); mail("email@address.com","WEBSITE QUERY","Form data: Name: " . $_POST['field_1'] . " Email: " . $_POST['field_2'] . " Company: " . $_POST['field_3'] . " Telephone: " . $_POST['field_4'] . " Message: " . $_POST['field_5'] . " "); include("confirm.php"); ?>
February 17, 201115 yr Think you both misread the thread, he already has the form working and he wants to style the email that is recieved so it looks a bit nicer, if I have read it right that is? So tables would be the way to go for this, but I'm not sure how to do it.
February 18, 201115 yr YOu need to change your headers and send a html email, as opposed to plaion text. BTW: using tables to style a foprm is considorted bad practice as it's not semantic. But he only wants it to be styled as an email in the email clien? Not in the actual form? Or am I completely wrong and missing the point?
February 20, 201115 yr Author Thats correct, its only the email I would like to style. The form is CSS styled. What part of this code needs to be edited without messing up the processing part i.e. sending the email?
February 21, 201115 yr Yep you've missed the point He wants to stryle the email. To style the email you'll need to set your headers to html as opposed the plain text Ahh, I wasn't questioning your first point about changing the headers to to html. It was about saying using tables to style a form is considered bad practice. But if you're sending it as an email, tables are the way to go? Is this what you would change the header too? header('Content-Type: text/html',true);
Create an account or sign in to comment