Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.

Thread Tools Display Modes
Share |
Old 11-12-2010, 06:09 AM
megadanny1 megadanny1 is offline
Junior Member
Join Date: 11-12-10
Posts: 2
iTrader: 0 / 0%
Question help me with PHP contact form please...

hi there
im making a contact form for my website (ukphonebuyers.co.uk) which is still under construction
and im having issues with it sending to my email
the code sends an email with the correct subject line but with no body

here is the code
the form is in html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Sell your old mobile now!</title> <link rel="stylesheet" type="text/css" href="view.css" media="all"> <script type="text/javascript" src="view.js"></script> </head> <body id="main_body" > <img id="top" src="top.png" alt=""> <div id="form_container"> <h1><a>Sell your old mobile now!</a></h1> <form id="form_303210" class="appnitro" method="post" action="sendmail.php"> <div class="form_description"> <h2>Sell your old mobile now!</h2> <p></p> </div> <ul > <li id="li_1" > <label class="description" for="element_1">Name </label> <span> <input id="element_1_1" name= "element_1_1" class="element text" maxlength="255" size="8" value=""/> <label>First</label> </span> <span> <input id="element_1_2" name= "element_1_2" class="element text" maxlength="255" size="14" value=""/> <label>Last</label> </span> </li> <li id="li_2" > <label class="description" for="element_2">Address </label> <div> <input id="element_2_1" name="element_2_1" class="element text large" value="" type="text"> <label for="element_2_1">Street Address</label> </div> <div> <input id="element_2_2" name="element_2_2" class="element text large" value="" type="text"> <label for="element_2_2">Address Line 2</label> </div> <div class="left"> <input id="element_2_3" name="element_2_3" class="element text medium" value="" type="text"> <label for="element_2_3">Town</label> </div> <div class="right"> <input id="element_2_4" name="element_2_4" class="element text medium" value="" type="text"> <label for="element_2_4"> Region I.E shropshire. </label> </div> <div class="left"> <input id="element_2_5" name="element_2_5" class="element text medium" maxlength="15" value="" type="text"> <label for="element_2_5">Post Code</label> </div> <div class="right"> <select class="element select medium" id="element_2_6" name="element_2_6"> <option value="" selected="selected"></option> <option value="United Kingdom" >United Kingdom</option> </select> <label for="element_2_6">Country</label> </div> </li> <li id="li_3" > <label class="description" for="element_3">Phone (Not Required but Recommended) </label> <div> <input id="element_3" name="element_3" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li id="li_4" > <label class="description" for="element_4">Email address </label> <div> <input id="element_4" name="element_4" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li id="li_5" > <label class="description" for="element_5">Please tell us what phone you want to sell in the box below. </label> <div> <input id="element_5" name="element_5" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li id="li_6" > <label class="description" for="element_6">2ND phone to be sold. </label> <div> <input id="element_6" name="element_6" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li id="li_7" > <label class="description" for="element_7">3RD phone to be sold. </label> <div> <input id="element_7" name="element_7" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li id="li_8" > <label class="description" for="element_8">4TH phone to be sold </label> <div> <input id="element_8" name="element_8" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li id="li_9" > <label class="description" for="element_9">Are you going to include any chargers? </label> <span> <input id="element_9_1" name="element_9" class="element radio" type="radio" value="1" /> <label class="choice" for="element_9_1">Yes.</label> <input id="element_9_2" name="element_9" class="element radio" type="radio" value="2" checked="checked"/> <label class="choice" for="element_9_2">No.</label> </span> </li> <li class="buttons"> <input type="hidden" name="form_id" value="303210" /> <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" /> </li> </ul> </form> <div id="footer"> </div> </div> <img id="bottom" src="bottom.png" alt=""> </body> </html>
and it posts to a php script which then sends the output to my email

here is the php part:

$two = $_REQUEST['element_1_1'] ; $three = $_REQUEST['element_1_2'] ; $four = $_REQUEST['element_2'] ; $five = $_REQUEST['element_2_1'] ; $seven = $_REQUEST['element_2_2'] ; $eight = $_REQUEST['element_2_3'] ; $six = $_REQUEST['element_2_4'] ; $nine = $_REQUEST['element_2_5'] ; $ten = $_REQUEST['element_2_6'] ; $tena = $_REQUEST['element_3'] ; $tenb = $_REQUEST['element_4'] ; $tenc = $_REQUEST['element_5'] ; $tend = $_REQUEST['element_6'] ; $tene = $_REQUEST['element_7'] ; $tenf = $_REQUEST['element_8'] ; $teng = $_REQUEST['element_9'] ; $tenh = $_REQUEST['element_9_1'] ; $teni = $_REQUEST['element_9_2'] ; mail( "<removed>", "Feedback Form Results", $message, "From: $email" ); header( "Location: http://www.ukphonebuyers.co.uk/index.html" ); ?>
i have put the the html and php files here


im sure its a simple error i missed becuese im rubbish at html and php
if you can solve it for me i would be really grateful

Last edited by J. H. Rasmussen; 10-26-2019 at 03:41 AM. Reason: Removed email on authors request.
Reply With Quote



Old 12-03-2010, 02:54 PM
KM- KM- is offline
Junior Member
Join Date: 12-02-10
Location: Rowland Heights, California
Posts: 9
iTrader: 0 / 0%
Well, for one you really should be sanitizing your variables.
$two = htmlentities($_REQUEST['element_1_1']);
if you are to insert the submitted values to a mysql database:
$two = mysql_real_escape_string($_REQUEST['element_1_1']);
Second, you haven't initialized the $message variable in the code you posted. If you're missing the body part, that is why.
$message = 'Hi. This is the body!';
Other issues can cause the body from not being correct, like incorrect headers, but your headers look too basic to have problems so they should be fine. Hope this helps.

Nice spam by the way. (Mod, maybe you should delete this thread.)

Last edited by KM-; 12-03-2010 at 03:19 PM. Reason: noticed spam message =/
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Contact form PHP thedude Coding Forum 2 04-09-2010 01:39 PM
contact form silver163 Coding Forum 4 10-08-2009 12:00 PM
I need help with contact form iorgyzu88 Coding Forum 7 09-17-2009 10:37 AM
What's the best way to set up a Contact form??? chrisnrach17 Web Design Lobby 8 12-06-2008 02:10 AM
Contact form please help to create a contact form jennypretty Coding Forum 2 07-03-2008 07:49 AM

V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory

All times are GMT -7. The time now is 04:06 AM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC