/    Sign up×
Community /Pin to ProfileBookmark

Submit form How to get the form in an Email

I am having trouble with a form that I want submitted through PHP. When it is submitted the email body has the text fields in it but they are in this form:

firstnamelastnameaddress

There are no spaces and the drop down menu, raido buttons and check boxes wont show up. How can I make it so when they submit the form the email will match the form’s form…if you get that. I have all these listed in my form:

Name
Address
City
State (drop down menu)
Zip
Email

5 Check Boxes (I need to know which ones they check)
4 more text boxes
1 Radio button group with 5 buttons (only 1 can be clicked on and I need to know which they picked)

How can I set up the PHP code for this?

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@trymbillNov 30.2007 — Can you post the script here so we can see what you mean exactly?
Copy linkTweet thisAlerts:
@viathanauthorNov 30.2007 — Ok, I listed the site bellow so you can see the finished page and here is the code for just the form:

[CODE]<form name="application1" method="post" action="application.php">
<label><strong>Name:</strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="firstname" type="text" id="firstname"
style="background-color: #f6f9ff;" size="15">
</label>
<input name="lastname" type="text" id="lastname"
style="background-color: #f6f9ff;" size="15">
(First, Last)
</p>
<p>&nbsp;</p>
<p><strong>Address: </strong> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<input name="address" type="text" id="address"
style="background-color: #f6f9ff;" size="30">
</p>
<p>&nbsp;</p>
<p><strong>City:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="city" type="text" id="city"
style="background-color: #f6f9ff;">
</strong></p>
<p>&nbsp;</p>
<p><strong> State:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<select name="state" style="background-color: #f6f9ff">
<option value="">State</option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District of Columbia</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
&nbsp;&nbsp;&nbsp;
Zip Code: </strong>
<input name="zip" type="text" id="zip" onKeyPress="return numbersonly(this, event)"
style="background-color: #f6f9ff;" size="5" maxlength="5">
</p>
<p>&nbsp;</p>
<p><strong>Phone: </strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="phone" type="text" id="phone" onKeyPress="return numbersonly(this, event)"
style="background-color: #f6f9ff;" size="10" maxlength="10">
Format: 5551237777</p>
<p>&nbsp;</p>
<p><strong>Email: </strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>
<input name="email" type="text" id="email"
style="background-color: #f6f9ff;">
</strong></p>
</form></td>
<td height="146" valign="top"><form name="application2" method="post" action="application.php">
<label><strong>Services: </strong></label>
(Choose all that apply)
<p>&nbsp;</p>
<p>
<label>
<input type="checkbox" name="psych" id="psych">
<span class="style3">School Psychology</span></label>
</p>
<p>
<input type="checkbox" name="speech" id="speech">
<span class="style3">Speech</span></p>
<p>
<input type="checkbox" name="ot" id="ot">
<span class="style3">OT</span></p>
<p>
<input type="checkbox" name="pt" id="pt">
<span class="style3">PT</span></p>
<p>
<input type="checkbox" name="teacher" id="teacher">
<span class="style3">Teacher</span> </p>
</form></td>
<td>&nbsp;</td>
<td colspan="2" valign="top">

<form name="application4" method="post" action="application.php" >
<label><strong>Expected Hourly Rate: <br>
$
<input name="hrlyrate" type="text" id="hrlyrate"
style="background-color: #f6f9ff;" onKeyPress="return numbersonly(this, event)" size="2" maxlength="2">
<br>
<br>
Number of Days to Contract:<br>
<br>
</strong></label>
<p>
<label>
<input type="radio" name="RadioGroup1" value="contractdays_1" id="contractdays_1">
1</label>
<label>
<input type="radio" name="RadioGroup1" value="contractdays_2" id="contractdays_2">
2</label>
<label>
<input type="radio" name="RadioGroup1" value="contractdays_3" id="contractdays_3">
3</label>
<label>
<input type="radio" name="RadioGroup1" value="contractdays_4" id="contractdays_4">
4</label>
<label>
<input type="radio" name="RadioGroup1" value="contractdays_5" id="contractdays_5">
5</label>
</p>
<label></label>
<p><br>
</p>
</p>



<input type=button value="Submit" onClick="SubmitAll()">
<input type=button value="Reset" onClick="ResetAll()">
</form></td>
<td></td>
</tr>


<tr>
<td colspan="3" rowspan="2" valign="top"><form name="application3" method="post" action="application.php">
<label><strong>Certifications: </strong></label>
(Fill in all that apply)
<p>&nbsp; </p>
<p><strong>1: </strong> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<input name="cert1" type="text" id="cert1"
style="background-color: #f6f9ff;">
</p>
<p><strong>2: </strong> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<input name="cert2" type="text" id="cert2"
style="background-color: #f6f9ff;">
</p>
<p><strong>3: </strong> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<input name="cert3" type="text" id="cert3"
style="background-color: #f6f9ff;">
</p>
</form>[/CODE]
Copy linkTweet thisAlerts:
@viathanauthorNov 30.2007 — Web Site:

http://www.edsupport.org/index-3.html


Here is the PHP code that I have so far that dosnt work:

[CODE]<?
$firstname = $_POST['firstname'] ;
$lastname = $_POST['lastname'] ;

$address = $_POST['address'] ;
$city = $_POST['city'] ;

$state = $_POST['state'] ;

$zip = $_POST['zip'] ;

$phone = $_POST['phone'] ;

$email = $_POST['email'] ;

$psy = $_POST['psy'] ;
$speech = $_POST['speech'] ;
$ot = $_POST['ot'] ;
$pt = $_POST['pt'] ;
$teacher = $_POST['teacher'] ;

$cert1 = $_POST['cert1'] ;

$cert2 = $_POST['cert2'] ;

$cert3 = $_POST['cert3'] ;

$hrlyrate = $_POST['hrlyrate'] ;

$contractdays_1 = $_POST['contractdays_1'] ;
$contractdays_2 = $_POST['contractdays_2'] ;
$contractdays_3 = $_POST['contractdays_3'] ;
$contractdays_4 = $_POST['contractdays_4'] ;
$contractdays_5 = $_POST['contractdays_5'] ;

$message = $first . $last . $address . $psy . $speech . $ot . $pt . $teacher ;

mail( "This Is My Email Address", "Ed Support Application",
$message, "From: $email" );
header( "Location: http://www.edsupport.org/thankyou.html" );
?>[/CODE]


I took my email out of the code above but its in the PHP file I have.
Copy linkTweet thisAlerts:
@viathanauthorDec 01.2007 — any help?
Copy linkTweet thisAlerts:
@roscorDec 01.2007 — I think it may be an headers issue

First your mail() function should include headers, see [URL]http://uk3.php.net/manual/en/function.mail.php[/URL]


from www.uk3.php.net
[code=php]

$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "rn" .
'Reply-To: [email protected]' . "rn" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

[/code]
Copy linkTweet thisAlerts:
@viathanauthorDec 02.2007 — its all set. thx
×

Success!

Help @viathan spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...