Support » Themes and Templates » HTML & PHP Contact Form Redirect

  • I’m trying to get a contact form to redirect to a separate thank you page, instead of just displaying a thank you message. The contact form code is part of a page template that I’m using Here’s what I’ve got.

    <div class="contform1" style="width:250px; height:400px; margin-left:40px; float:left; ">
           <form class="estimate-form sidebar-box" method="post" action="" id="ContactForm" onsubmit="return requestvalidate()">
    		<?php if(!isset($_POST['form-submitted'])){ ?>
    			<input type="text" name="form-name" id="form-name" placeholder="Enter Name" onblur="onBlur(this)" onfocus="onFocus(this)" />
    			<input type="text" name="form-email" id="form-email"  placeholder="Enter Email Address" onblur="onBlur(this)" onfocus="onFocus(this)" />
    			<input type="text" name="form-phone" id="form-phone" placeholder="Enter Number" onblur="onBlur(this)" onfocus="onFocus(this)" />
                <textarea style="height:180px; width:220px;"  name="comment" cols="10" placeholder="Comments" onblur="onBlur(this)" onfocus="onFocus(this)"></textarea>
                <input type="hidden" name="form-submitted" value="yes" />
    			<input type="submit" class="button-style-b" value="GET HELP NOW!" />
    		<?php } else {
    			$receiverEmail = "";
    			$message = '-- New Contect --'."\r\n"."\r\n".'Name: '.$_POST['form-name']."\r\n".'Phone Number: '.$_POST['form-phone']."\r\n".'Email address: '.$_POST['form-email']."\r\n".'Comment: '.$_POST['comment']."\r\n"."\r\n".'-- Email sent from contact form on '.get_permalink(get_the_ID()).' --';
    			$to      = $receiverEmail;
    			$subject = 'Need to Contect us !';
    			$headers = 'From: '.$_POST['form-email']."\r\n".
    					   'Reply-To: '.$_POST['form-email'];
    			mail($to, $subject, $message, $headers);
    			<h1>Your request has been submited.</h1>Thank you for your interest, one of our representatives will be in touch with you soon.<br/><br/>
    		<?php } ?>

    I’ve already tried using the “hidden value” HTML line but that didn’t work. Any other suggestions?

  • The topic ‘HTML & PHP Contact Form Redirect’ is closed to new replies.