Sending a form via sendmail

Reply

Join Date: Dec 2007
Posts: 1
Reputation: ericjw316 is an unknown quantity at this point 
Solved Threads: 0
ericjw316 ericjw316 is offline Offline
Newbie Poster

Sending a form via sendmail

 
0
  #1
Dec 6th, 2007
I am new to this PHP thing. I have programmed in VS 2003 and VB and C# for web site. I am working for this new company and all their forms are sent via send mail.

My problem is that i am trying to send multiple variables to send mail and i just dont know what to do as this is my first time using it.

Here is the code i am working on:

<form id="form1" name="form1" method="post" action="sendmail2.php">
<table width="57%" border="0" cellspacing="6" cellpadding="0">
<tr>
<td class="blackfont"><strong>*First Name</strong></td>
</tr>
<tr>
<td class="blackfont"><input name="name_req" type="text" class="style1" id="name_req" size="35" tabindex="1" /></td>
</tr>
<tr>
<td class="blackfont"><strong>*Last Name</strong></td>
</tr>
<tr>
<td class="blackfont"><input name="lastname_req" type="text" id="lastname_req" size="35" tabindex="2" /></td>
</tr>
<tr>
<td class="blackfont"><strong>*Mailing Address</strong></td>
</tr>
<tr>
<td class="blackfont"><input name="address_req" type="text" id="address_req" size="35" tabindex="3" /></td>
</tr>
<tr>
<td class="blackfont"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="39%"><strong>*City</strong></td>
<td width="27%"><strong>State</strong></td>
<td width="34%"><strong>Zip</strong></td>
</tr>
</table></td>
</tr>
<tr>
<td class="blackfont"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="39%"><input type="text" name="City_req" tabindex="4" /></td>
<td width="27%"><input name="State" type="text" size="10" tabindex="5" /></td>
<td width="34%"><input type="text" name="Zip" tabindex="6" /></td>
</tr>
</table></td>
</tr>
<tr>
<td class="blackfont"><strong>Phone #</strong></td>
</tr>
<tr>
<td class="blackfont"><input name="Phone_Number" type="text" size="35" tabindex="7" /></td>
</tr>
<tr>
<td class="blackfont"><strong>*Email address</strong></td>
</tr>
<tr>
<td class="blackfont"><input name="Email_Address_req" type="text" size="35" tabindex="8"/></td>
</tr>
<tr>
<td class="blackfont"><strong>*Size of parking space interested in (select one):</strong></td>
</tr>
<tr>
<td class="blackfont"><strong>
<label>
<select name="parkingspace_size" id="parkingspace_size" tabindex="9">
<option value="lO x 30 uncovered">l0 x 30 uncovered</option>
<option value="12 X 40 covered">12 X 40 covered</option>
<option value="12 X 50 covered">12 X 50 covered</option>
</select>
</label>
</strong></td>
</tr>
<tr>
<td class="blackfont"><strong>*Size of Mini-storage interested in(select one):</strong></td>
</tr>
<tr>
<td><select name="ministorage_size" id="ministorage_size" tabindex="10">
<option value="5 X 10">5 X 10</option>
<option value="10 X 10">10 X 10</option>
</select></td>
</tr>
<tr>
<td class="blackfont"><strong>Comments</strong></td>
</tr>
<tr>
<td><label>
<textarea name="Comments" cols="35" rows="5" tabindex="11"></textarea>
</label></td>
</tr>
<tr>
<td><label>
<input type="submit" name="Submit" value="Submit" tabindex="12" />
</label></td>
</tr>
</table>
</form>


and the corresponding php code to this form

<?
$name_req = $_REQUEST['name_req'] ;
$lastname_req = $_REQUEST['lastname_req'] ;
$address_req = $_REQUEST['address_req'] ;
$City_req = $_REQUEST['City_req'] ;
$State = $_REQUEST['State'] ;
$Zip = $_REQUEST['Zip'] ;
$Phone = $_REQUEST['Phone'] ;
$Email_Address = $_REQUEST['Email_Address'] ;
$parkingspace_size = $_REQUEST['parkingspace_size'] ;
$ministorage_size = $_REQUEST['ministorage_size'] ;
$comments = $_REQUEST['comments'] ;
'$message = $name_req + $lastname_req + $address_req + $City_req,$State + $Zip + $Phone + $parkingspace_size + $ministorage_size + $comments'
mail( "e.williams.bis@gmail.com", "Questions About you Spaces Available.",
$message = $name_req + $lastname_req + $address_req + $City_req,$State + $Zip + $Phone + $parkingspace_size + $ministorage_size + $comments,
"From: $Email_Address" );
print "Your Questions have been sent to the White Tanks Storage Team";
?>



If any of you can help me out i would appreciate it.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 596
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 125
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro

Re: Sending a form via sendmail

 
0
  #2
Dec 6th, 2007
Are you wanting to put all of the variables into one string called $message? If so:
  1. $message = "$name_req $lastname_req $address_req $City_req,$State $Zip $Phone $parkingspace_size $ministorage_size $comments";
  2. mail( "e.williams.bis@gmail.com", "Questions About you Spaces Available.",
  3. $message,"From: $Email_Address" );
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1739 | Replies: 1
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC