[b]Hi! I am changing up a free contact form a bit. I am actually changing it to a feedback form, but can’t figure out the radio buttons code in the php.
Here is my html code, which I have correct:[/b]
[code]
Customer Feedback Form
Fields marked with * are required.
|
Company Name *
|
|
Your Name *
|
|
Email Address *
|
|
<tr>
<td valign="top" class="cffree_td">
<label for="Telephone_Number" class="not-required">Telephone Number</label>
</td>
<td valign="top" class="cffree_td">
<input type="text" name="Telephone_Number" id="Telephone_Number" maxlength="100" style="width:250px">
</td>
</tr>
<tr>
<td valign="top" class="cffree_td">
<label for="Part_Number" class="not-required">Part Number(s)</label>
</td>
<td valign="top" class="cffree_td">
<input type="text" name="Part_Number" id="Part_Number" maxlength="100" style="width:250px">
</td>
</tr>
<tr>
<td valign="top" class="cffree_td">
<label for="Email_Address" class="required">How satisfied were you with your order?<span class="required_star"> * </span></label>
</td>
<td valign="top" class="cffree_td">
<input type="radio" name="satisfied" />Very Satisfied
<input type="radio" name="satisfied" />Satisfied
<input type="radio" name="satisfied" />Not Satisfied
</td>
</tr>
<tr>
<td valign="top" class="cffree_td">
<label for="Your_Message" class="required">Please comment on your VIP experience:<span class="required_star"> * </span></label>
</td>
<td valign="top" class="cffree_td">
<textarea style="width:270px;height:120px" name="Your_Message" id="Your_Message" maxlength="2000"></textarea>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center" class="cffree_td">
<br />
<div class="bumpRight">
<input type="submit" value=" Submit Form "></div>
<br /><br />
<br /><br />
</td>
</tr>
</table>
[/code]
[b]Here's what I need to change in the php for the radio buttons, but I don't know how:[/b]
[php]<?php
if(isset($_POST[‘Email_Address’])) {
include 'free_settings.php';
function died($error) {
echo "Sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
if(!isset($_POST['Company_Name']) ||
!isset($_POST['Full_Name']) ||
!isset($_POST['Email_Address']) ||
!isset($_POST['Telephone_Number']) ||
!isset($_POST['Part_Number']) ||
!isset($_POST['Your_Message'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$company_name = $_POST['Company_Name']; // required
$full_name = $_POST['Full_Name']; // required
$email_from = $_POST['Email_Address']; // required
$telephone = $_POST['Telephone_Number']; // not required
$part_number = $_POST['Part_Number']; // not required
$comments = $_POST['Your_Message']; // required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(preg_match($email_exp,$email_from)==0) {
$error_message .= ‘The Email Address you entered does not appear to be valid.
’;
}
if(strlen($company_name) < 2) {
$error_message .= ‘Your Company Name does not appear to be valid.
’;
}
if(strlen($full_name) < 2) {
$error_message .= ‘Your Name does not appear to be valid.
’;
}
if(strlen($comments) < 2) {
$error_message .= ‘The Comments you entered do not appear to be valid.
’;
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = “A customer has submitted a feedback form. See the form details below:\r\n”;
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Company Name: ".clean_string($company_name)."\r\n";
$email_message .= "Full Name: ".clean_string($full_name)."\r\n";
$email_message .= "Email: ".clean_string($email_from)."\r\n";
$email_message .= "Telephone: ".clean_string($telephone)."\r\n";
$email_message .= "Part Numbers: ".clean_string($part_number)."\r\n";
$email_message .= "Message: ".clean_string($comments)."\r\n";
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
‘X-Mailer: PHP/’ . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
header(“Location: $thankyou”);
?>
<?php
}
die();
?>[/php]
One last thing - The custom thankyou page comes up when these pages are saved as html, but doesn’t when I save them as a php pages. Is there a way to fix this? Thanks so much!!
[php]<?php
$email_to = "[email protected]"; // your email address
$email_subject = “A Customer has Submitted Feedback!”; // email subject line
$thankyou = “thankyou.php”; // thank you page
?> [/php]