Verification Box

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
th3gh05t
Forum Newbie
Posts: 22
Joined: Tue Apr 20, 2004 11:52 pm

Verification Box

Post by th3gh05t »

Hi,

I am interested in making a page where it has a text box and a Submit button. And if the ext that is entered is correct, it redirects to another page. If it is wrong, it redirects to an error page.

I have this code so far:

Code: Select all

<?
if ($question)
&#123;
   if ($question=='DevsDancin, devsdancin, ladybug070, Ladybug070')
   &#123;
        header("Location: fullurlofpage")
   &#125;
   else
   &#123;
       header("Location: fullurlofwrongpage");
   &#125;
&#125;
?>
Can you please help me out?

Thanks, th3gh05t
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

if(!empty($question))
{
  $validMatches = array();
  $validMatches[] = 'devsdancin';
  $validMatches[] = 'ladybug070';
  foreach($validMatches as $validMatch)
  {
    if(strcasecmp($validMatch,$question)==0)
    {//found a match
      header("Location: http://...");
    }
  }
  //didn't find a match from the list
  header("Location: http://...");
}
//$question wasn't set or was an empty condition.
th3gh05t
Forum Newbie
Posts: 22
Joined: Tue Apr 20, 2004 11:52 pm

Post by th3gh05t »

Thanks for your help! :D
Post Reply