Emailing form content (Full Version)

All Forums >> [Web Development] >> General Web Development



Message


littletiny45 -> Emailing form content (6/19/2008 13:46:07)

I created a php form to pass the forms content to my email. All fields pass with the exception of the radio buttons. The radio button that's selected will not come to my email address. How do you get the selected radio button to show up in your email?

Here's my radio buttons on the form:

<tr>
<td colspan="2" valign="top" align="right"><strong>What type web site?</strong>*</td>
<td colspan="2" valign="top"><input type="radio" name="purpose" value="business" id="business">Business<br>
<input type="radio" name="purpose" value="personal" id="personal">Personal</td>
</tr>

<tr>
<td colspan="3" valign="top" align="right"><strong>What is your intended budget for the web site?</strong>*</td>
<td valign="top"><input type="radio" name="budget" value="thousand"> Less than $1,000<br>
<input type="radio" name="budget" value="twothou"> $1,001 - $2,000<br>
<input type="radio" name="budget" value="fourthou"> $2,001 - $4,000<br> <input type="radio" name="budget" value="more"> $4,001 or More</td>
</tr>

Here's the radio button part of my php form:

$thousand = RemoveXSS( $_REQUEST['thousand'] );
$twothou = RemoveXSS( $_REQUEST['twothou'] );
$fourthou = RemoveXSS( $_REQUEST['fourthou'] );
$more = RemoveXSS( $_REQUEST['more'] );

$headers = "From: $email";
$message1 = "Name: $first $last | Phone Number: $phone | Email: $email";
$message2 = "Purpose: $business $personal";
$message3 = "Budget: $thousand $twothou $fourthou $more";
$message4 = "Concept: $concept";

When I get an email it just says Purpose: | Budget: (both are blank even though I know something was selected)




ou812 -> RE: Emailing form content (6/19/2008 16:24:54)

You need to grab the contents of budget and purpose, the name of your radio buttons.

$mybudget = RemoveXSS( $_REQUEST['budget'] );
$mypurpose = RemoveXSS( $_REQUEST['purpose'] );

$headers = "From: $email";
$message1 = "Name: $first $last | Phone Number: $phone | Email: $email";
$message2 = "Purpose: $mypurpose";
$message3 = "Budget: $mybudget";
$message4 = "Concept: $concept";






littletiny45 -> RE: Emailing form content (6/19/2008 16:50:56)

Thanks a lot OU812 that worked!! One more question. Is there a way to get the messages to appear on separate lines in the email?




ou812 -> RE: Emailing form content (6/19/2008 19:16:34)

I'm guessing you are sending text email. If so, I believe the "\n" should work.

Something like:

$message1 = "Name: $first $last | Phone Number: $phone | Email: $email \n";
$message2 = "Purpose: $mypurpose \n";
$message3 = "Budget: $mybudget \n";
$message4 = "Concept: $concept \n";




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
4.492188E-02