Feed back form
-
I have this form in the footer of my wordpress blog but when i test it on my blog it doesnt validate and display the error messages it is supposed to. The site is located here and the form can be found at the bottom. If you can give any suggestions please let me know.
regards
benjamin shepherd<h3>Feedback</h3>
<?phpfunction set_field_value($form)
{
return isset($_POST[$form]) ? $_POST[$form] : ”;
}function show_field_error($form)
{
global $error;
return isset($error[$form]) ? ‘<label style=”color:red”><b>’.$ferror[$form].'</b></label>’ : ”;
}if(isset($_POST[‘submit’]))
{
if(isset($_POST[‘fname’]) && empty($_POST[‘fname’]))
{
$error[‘fname’] = ‘Please fill in your name’;
}if(isset($_POST[‘femail’]) && empty($_POST[‘femail’]))
{
$error[‘femail’] = ‘Please fill in your email’;
}if(isset($_POST[‘fback’]) && empty($_POST[‘fback’]))
{
$error[‘fback’] = ‘Please fill in feedback’;
}
if (!$error)
{
$mailMessage = “Name: “.$_POST[‘fname’].” Email: “.$_POST[‘femail’].” Feedback: “.$_POST[‘fback’];
echo “Feedback Submitted”;
mail(‘[email protected]’,’Website Feedback’, $mailMessage);
}
}?>
<form action=”” method=”post” name=”feedbackform”>
<?php
echo show_field_error(‘fname’);
echo show_field_error(‘femail’);
echo show_field_error(‘fback’);
?><label>Full Name:</label>
<input class=”fname” size=”20″ type=”text” name=”fname” value=”<?php echo set_field_value(‘fname’); ?>” /><label>Email:</label>
<input class=”femail” type=”text” name=”femail” value=”<?php echo set_field_value(‘femail’); ?>” /><label class=”ftextlabel”>Let us know what we can do to make your experience on this site better</label>
<textarea class=”ftext” type=”text” name=”fback” ><?php echo set_field_value(‘fback’); ?></textarea><input class=”fsubmit” type=”submit” value=”Send Feedback” />
<label>*All fields required</label></form>
- The topic ‘Feed back form’ is closed to new replies.