Page 1 of 1

Verification Box

Posted: Tue Apr 20, 2004 11:52 pm
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

Posted: Wed Apr 21, 2004 2:03 am
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.

Posted: Wed Apr 21, 2004 1:07 pm
by th3gh05t
Thanks for your help! :D