User input to determine redirect/ link I need the code for if the user enters in a co

Started on the old forum in October 2011 · view the original in the archive · old links redirect here

4 replies · 722 views · started 15 years ago · 1 min read

2 participants
johnwboyd Junior · 12 posts #1

I need the code for if the user enters in a code into the field for example E1 and clicks submit it'll redirect them to a certain form. And if another user entered in E2 it would redirect them to a DIFFERENT form. I hope this is the correct category of the site for me to post this. Wasn't sure if it would be javascript or PHP. But I need the code in entirety not just a vague snip or concept. Thanks!

i0nutzxp Developer · 150 posts #2

Entirely code you wont receive:

<?php
if (isset($_POST['cmd']))
{
    switch ($_POST['cmd'])
   {
      case 'F1': header('Location: toHell.php'); exit; break;
      case 'E2': header('Location: toHeaven.php'); exit; break;  
   }
}
?>
<form action="test.php" method="POST">
CMD: <input type="text" name="cmd"/>
 <input type="submit" name="submit" value="GO"/>
</form>
<?php unlink('World/Europe/Romania.country'); ?>
johnwboyd Junior · 12 posts #3

This is excellent! Thank you so much!

Added after 7 minutes:

Would it be possible to pass through that variable to post into the form which would be the redirect? It'll actually be a google docs form. For example, E2 would post into the referral key field.

i0nutzxp Developer · 150 posts #4

Can you be more clear? Some examples of what forms you have?

<?php unlink('World/Europe/Romania.country'); ?>

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close