PHP Classes

PHP Form

Recommend this page to a friend!

      Top level forums  >  PHP Specialists  >  General  >  PHP Form  
Subject:PHP Form
Summary:unable to send radio button selection and need to redirect
Messages:2
Author:Demetrius McClain
Date:2011-03-14 22:03:13
Update:2011-04-05 21:09:52
 

  1. PHP Form   Reply   Report abuse  
Picture of Demetrius McClain Demetrius McClain - 2011-03-14 22:46:58
I have tried several solutions to this problem but to no avail. The form sends everything except the radio button value. I am providing the html form and php script below can you please let me know what I'm doing wrong? Also, I tried using header("Location:index.html"); but it doesn't work with this form. I placed the code after $send_contact=mail($to,$subject,$message,$header);. Am I not putting it in the right place? Your assistance will be greatly appreciated.

HTML CODE:

<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td style="color:#FFF;"><strong>Contact Form </strong></td>
</tr>
</table>

<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="send_contact.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td style="color:#FFF;" width="16%">Name</td>
<td style="color:#FFF;" width="2%">:</td>
<td width="82%"><input name="name" type="text" id="name" size="50"></td>
</tr>
<tr>
<td style="color:#FFF;">Email</td>
<td style="color:#FFF;">:</td>
<td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
</tr>
<tr>
<td style="color:#FFF;">Subcribe</td>
<td style="color:#FFF;">:</td>
<td style="color:#FFF;"><input type="radio" name="subcribe" id="subcribe" value="Yes" checked="checked" /> Yes
<input type="radio" name="subcribe" id="subcribe" value="No" /> No</td>
</tr>
<tr>
<td style="color:#FFF;">Comments</td>
<td style="color:#FFF;" >:</td>
<td><textarea name="comments" cols="50" rows="4" id="comments"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>

PHP CODE
<?php

// Details
$message="$comments";

// Subscription
$subcribe= $_POST['subcribe'];

// Mail of sender
$mail_from="$customer_mail";
// From
$header="from: $name <$mail_from>";

// Enter your email address
$to ='info@demetriusmcclain.com';

$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){
echo "Your information was successfully submitted. Return to";
}
else {
echo "ERROR";
}
?>


There is 1 reply in this thread, which is not being displayed.
Browsing this forum thread replies is available only to premium subscribers.


Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum.