Link bassed on what was typed into box.

miatthas

New Member
Hi. I'm working on a portion of the website where a user can type in some test, and if the text is recognized, then it when they click a submit button, it will take them to a page relevant to what they typed in. If they type something in wrong, they go to a another page. I'm guessing some kind of java-script would do it.

Thank you very much in advance.
 

MarkR

New Member
You could do this in PHP very easily:

PHP:
if(isset($POST['text_sub'])){

  if($POST['text_sub'] == 'yourtext')
     header('location: success.php');
  else
    header('location: fail.php');

}
 

miatthas

New Member
thank you for your response, but i'm not exactly sure where to put the code.

HTML:
<div>
<form>
  <div align="center"><p>First Name 
  <input name="firstname" type="text" />
  </p></div>
    <div align="center"><input type="submit" name="login" id="login" value="Login"/></div>
</form>
</div>

Would you put the code in the header or the body? Also, would there be and client side scripts that would run this as well?
 
Top