Hi,
i have a contact form with this code:
<?php
if(isset($_POST['submit']))
{
$flag=1;
if($_POST['yourname']=='')
{
$flag=0;
echo "Please Enter Your Name<br>";
}
else if(!preg_match('/[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*/',$_POST['yourname']))
{
$flag=0;
echo "Please Enter Valid Name<br>";
}
if($_POST['email']=='')
{
$flag=0;
echo "Please Enter E-mail<br>";
}
else if(!eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$", $_POST['email']))
{
$flag=0;
echo "Please Enter Valid E-Mail<br>";
}
if($_POST['subject']=='')
{
$flag=0;
echo "Please Enter Subject<br>";
}
if($_POST['message']=='')
{
$flag=0;
echo "Please Enter Message";
}
if ( empty($_POST) )
{
print 'Sorry, your nonce did not verify.';
exit;
}
else
{
if($flag==1)
{
wp_mail(get_option("admin_email"),trim($_POST[yourname])." sent you a message from StraightForwardLegal.com".get_option("blogname"),stripslashes(trim($_POST['message'])),"From: ".trim($_POST['yourname'])." <".trim($_POST['email']).">\r\nReply-To:".trim($_POST['email']));
echo "Thank you for contacting us!<br> We have received your email. <br> One of our Workers' Compensation Attorneys <br> will be in touch with you as soon as possible";
header ("location: http://www.straightforwardlegal.com"); exit;
}
}
}
?>
and then,
<div class="frontForm">
<form method="post" id="contactus_form"><span style="font-size: 12px;>
<div class="left">
Name*:<br><input type="text" name="yourname" id="yourname" rows="1" maxlength="35"><br>
Email*:<br><input type="text" name="email" id="email" rows="1" value=""><br>
Phone*:<br><input type="text" name="subject" id="subject" rows="1" columns="8" style= "max-height: 18px; min-height: 18px;" value="" /></td></tr>
</div>
<div class="right" style="margin-top: -120px;"/>
Message*:<textarea name="message" id="message" rows="5" style="height: 90px;"></textarea><br><br>
<input type="submit" name="submit" id="submit" value="Send"/></span>
</form>
</div>
</div>
</div>
</div>
I used
header ("location: http://www.straightforwardlegal.com"); exit;
but, it does not work. After submitting my contact form, the user gets taken to my contact page instead of going to my home page? I was wondering if someone could let me know what I have done wrong?
Thank you,
Megan