PHP redirect form to URL not working -
so i'm trying use http://www.formget.com/how-to-redirect-a-url-php-form/ rsvp form.
ideally, entering right code on (http://baby.engquist.com/invite/) lead google form. however, when enter code (right or wrong) , press button, refreshes /invite page.
my code follows:
<p style="text-align: center;"> <form action="index.php" id="#form" method="post" name="#form"> <div class="row"> <div class="large-3 columns large-centered"> <div class="row collapse"> <div class="small-10 columns"> <input id="code" name="code" placeholder="enter code rsvp." type="text" > </div> <div class="small-2 columns"> <input id='btn' name="submit" type='submit' class="button prefix" value='go'> </div> </div> </div> </div> <?php include "redirect.php"; ?> </form> </p>
and included redirect.php:
<?php if(isset($_post['submit'])){ // fetching variables of form travels in url $code = $_post['code']; if($code ='show620') { // redirect form on particular page header("location:http://google.com/"); } else { print "oops that's not right code. try again!"; } ?>
thanks help!
you should have action attribute pointing file processing after submitting. in case redirect.php
use :
<form action="redirect.php" > ............
and dont include redirect.php
@ bottom of form.
Comments
Post a Comment