Agreaves Posted August 24, 2012 Share Posted August 24, 2012 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> Quote Link to comment https://forums.phpfreaks.com/topic/267527-how-to-send-generated-form-data-by-email/ Share on other sites More sharing options...
Christian F. Posted August 24, 2012 Share Posted August 24, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/267527-how-to-send-generated-form-data-by-email/#findComment-1372162 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.