Jump to content

Recommended Posts

Below I have a form generated from a php script but I want to be able to send the results by email. How should I go about formatting this in php?

<form method="post" name="body" action="mail.php"><table align="left" width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left"><b>Name:</b></td>
<td><input type="text" name="name" size="30" /></td>
  	</tr>
  	<tr height="10"><td></td></tr>
  	<tr>
    <td align="left"><b>Email:</b></td>
    <td><input type="text" name="email" size="30" /></td>
</tr>
</table><table align ="center" border="0" padding="15" width="100%"><tr height="10"><td></td></tr><tr id="hdg_bkgrnd"><td width="50"></td><td><b>Id</b></td><td align="left"><b>Name</b></td><td align="left"><b>Quantity</b></td><td align="right"><b>Amount</b></td></tr><tr height="50"><td align="left"><img name='' src='../images/bottle_openers/6966.jpg' width='50' height='50' alt='' /></td><td align"center\ id="cols_bkgrnd"><div name="id">6966</div></td><td align="left" id="cols_bkgrnd">Bottle Opener</td><td align="left" id="cols_bkgrnd">4 <a href="/cart/index.php?action=remove&id=6966">X</a></td><td align="right" id="cols_bkgrnd">$20</td></tr><tr height="50"><td align="left"><img name='' src='../images/candle_holders/4907.jpg' width='50' height='50' alt='' /></td><td align"center\ id="cols_bkgrnd"><div name="id">4907</div></td><td align="left" id="cols_bkgrnd">Skull Candle Holder</td><td align="left" id="cols_bkgrnd">1 <a href="/cart/index.php?action=remove&id=4907">X</a></td><td align="right" id="cols_bkgrnd">$5</td></tr><tr id="hdg_bkgrnd"><td></td><td></td><td></td><td align='right'><div id="total"><b>Total</b></div></td><td align='right'>$25</td></tr><tr><td></td><td colspan="3" align="right"><input id="submit_btn" name="submit" value="Submit" type="button"/></td><td colspan="3" align="right"><a id="cart_btn" href="/cart/index.php?action=empty" onclick="return confirm('Are you sure?');">Empty</a></td></tr></table></form>

I recommend that you start here: http://www.php.net/manual/en/tutorial.php

Then, check up on "phpMailer" or some similar class for sending mails.

 

PS: You'll need to read up on input validation and output escaping (latter for e-mails) as well, to prevent attackers from abusing your script to send spam mail to everyone on the planet.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.