If Statement That Runs on Form Submit
I have a real simple form where the use enters a word and hits submit. The word is then appended to the end of a url that I have in the code and redirects to the new url. The script I have is working but the only thing I can't figure out how to do is when it hits submit I want it to run an if statement first that checks the word they entered and if it's the exact match to a word we have in the if statement it redirects. If it doesn't match it says a line of text under the text box "Sorry that word is incorrect". Here's the working code. Any help would be GREATLY appreciated.
header("Location: http://www.google.com/" . $_POST['folder']);
<form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="folder" id="folder" />
<input type="submit" name="bt" id="bt" value="Go To" />