...

View Full Version : Radio buttons are not printing to php from form



yeahjohn
12-15-2008, 07:34 PM
I am just trying to resolve this issue with a basic form I have. I need to print radio button results from form to php script to email. I cant seem to figure it out. I would think it would require and if else statement but I have seen searching around and cant seem to find a direct fix for my issue. Please help.

My form looks like this:

<form method="post" action="send.php">
<table width="100%" align=left bgcolor=#99FF99>
<tr>
<td colspan=2 align="left" valign="top" class="style1">Free Debt Evaluation</td>
</tr>
<tr>
<td width="83" align="left" valign="top" class="style2"><font color=red>*</font> Name:</td>
<td width="534" align="left" valign="top"><input size=25 name="Name"></td>
</tr>
<tr>
<td align="left" valign="top" class="style2"><font color=red>*</font> Email:</td>
<td align="left" valign="top"><input size=25 name="Email"></td>
</tr>
<tr>
<td align="left" valign="top" class="style2">Phone:</td>
<td align="left" valign="top"><input size=25 name="Phone"></td>
</tr>
<tr>
<td align="left" valign="top">&nbsp;</td>
<td align="left" valign="top">&nbsp;</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2">Are you interested in having one or more credit card debts settled?</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2"><table width="200">
<tr>
<td class="style2"><label>
<input type="radio" name="intrest" value="intrestYes" id="intrest_0" />
Yes</label></td>
</tr>
<tr>
<td class="style2"><label>
<input type="radio" name="intrest" value="intrestNo" id="intrest_1" />
No</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2">What is the name of the card (Chase, Capital One, Discover)?</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2"><label>
<input type="text" name="Card" id="Card" />
</label></td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2">What is the name of the Collection Agency?</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2"><label>
<input type="text" name="Agency" id="Agency" />
</label></td>
</tr>
<tr>
<td height="20" colspan="2" align="left" valign="top" class="style2">Can you fax a copy of the collection notice to us at 888-XXX-XXXX?</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2"><table width="200">
<tr>
<td><label>
<input type="radio" name="fax" value="faxYes" id="fax_0" />
Yes</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="fax" value="faxNo" id="fax_1" />
No</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2">Are you able to deposit 50% of the balance due in a trust fund, plus the one time settlement fee within 7 days?</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2"><table width="200">
<tr>
<td><label>
<input type="radio" name="desposite" value="despositeYes" id="desposite_0" />
Yes</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="desposite" value="despositeNo" id="desposite_1" />
No</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2">Is your account from a Law Firm and have you received a Court Summons?</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2"><table width="200">
<tr>
<td><label>
<input type="radio" name="law" value="lawYes" id="law_0" />
Yes</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="law" value="lawNo" id="law_1" />
No</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2">Are you prepared to deposit 80% of the balance due plus a one time settlement fee within 7 days?</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2"><table width="200">
<tr>
<td><label>
<input type="radio" name="prepared" value="preparedYes" id="prepared_0" />
Yes</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="prepared" value="preparedNo" id="prepared_1" />
No</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2">Do you need to setup a payment plan instead?</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2"><table width="200">
<tr>
<td><label>
<input type="radio" name="plan" value="planYes" id="plan_0" />
Yes</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="plan" value="planNo" id="plan_1" />
No</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2"><p>Do you understand that if no agreeable settlement can be reached within 14 days, we will return your deposit and fee in full within 7 days via standard mail?</p></td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2"><table width="200">
<tr>
<td><label>
<input type="radio" name="setlement" value="setleYes" id="setlement_0" />
Yes</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="setlement" value="setleNo" id="setlement_1" />
No</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2">Do you understand if a better settlement can be reached we will return any unused funds to you within 7 days via standard mail?</td>
</tr>
<tr>
<td colspan="2" align="left" valign="top" class="style2"><table width="200">
<tr>
<td><label>
<input type="radio" name="refund" value="refundYes" id="refund_0" />
Yes</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="refund" value="refundNo" id="refund_1" />
No</label></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan=2 align="left" valign="top" class="style2">Is there anything else we need to know?</td>
</tr>
<tr>
<td colspan=2 align=left valign="top" class="style2"><textarea name="Message" rows=5 cols=35></textarea></td>
</tr>
<tr>
<td colspan=2 align=left valign="top" class="style2">&nbsp;</td>
</tr>
<tr>
<td colspan=2 align=left valign="top" class="style2">Click here for, NO settlement, No Fee!</td>
</tr>
<tr>
<td colspan=2 align=left valign="top" class="style2"><input type=submit name="send" value="Submit"></td>
</tr>
<tr>
<td colspan=2 align=left valign="top" class="style2"><small>A <font color=red>*</font> indicates a
field is required</small></td>
</tr>
</table>
</form>


My php looks like this:

<?php
if(isset($_POST['send'])) {


$to = "me@email.com";
$from = $_REQUEST['Email'] ;
$subject = "Free Credit Setlement Consultation";

$name_field = $_POST['Name'];
$email_field = $_POST['Email'];
$phone = $_POST['Phone'];
$card = $_POST['Card'];
$agency = $_POST['Agency'];
$message = $_POST['Message'];
$intrest = $_POST['Intrest'];


$body = "We have received the following report:\n\n From: $name_field\n E-Mail: $email_field\n $check_msg Phone: $phone\n Card: $card\n Agency: $agency\n Message: $message\n Intrested: $intrest\n ";

echo "$name_field thank you for submiting your information.";
mail($to, $subject, $body, $from);


} else {

echo "yeah right!";

}
?>

jamestooks
12-15-2008, 07:52 PM
Can't you just use $_POST['law'] and $_POST['refund'] to get the values of the radio buttons?

yeahjohn
12-15-2008, 08:04 PM
I tried and it did not print to email, the text field work, the one radio field I added so far did not, that would be 'intrest'.




$name_field = $_POST['Name'];
$email_field = $_POST['Email'];
$phone = $_POST['Phone'];
$card = $_POST['Card'];
$agency = $_POST['Agency'];
$message = $_POST['Message'];
$intrest = $_POST['Intrest'];



The bold is a radio group, do i need to list the value for the 'yes' and the 'no' or just the group name 'intrest'?

yeahjohn
12-15-2008, 08:09 PM
NO WAY! I spent all moring on this and I had one simple mistake "intrest" was capitalized in my code! I hate that. Sorry for wasting your time cyberspace.

jamestooks
12-15-2008, 08:14 PM
You also need to be careful with some of your spellings - might make it harder to find variables when the words you have used are spelt wrong.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum