0

Question y'all.. I just finished my HTML sub material talking about "form" and i wondered..

1. Is there anyway you can redirect information in this case, E-mail and passwords, to a certain link? For example, if you put "a" you will be redirected to the destined url and if insert "b" you will be redirected to a different url 2. Lastly, is it possible to code so that if you insert neither "a" nor "b" you won't be redirected anywhere? 3. Does both my question could be done in HTML or does it involves other program?

8th Jun 2020, 10:38 AM
Yours.Patrick
Yours.Patrick - avatar
2 Réponses
+ 2
I suggest using PHP - there's a nifty function called header() that redirects the user based on form evaluation. If you wish I can try stringing together a piece of code that should do what you want. Pseudocode: <?php $userInput = $_POST['mail']; if(isset($_POST['submit'])){ if( $userInput == 'a') { header('Location: index.php'); } else { header('Location: anotherPage.php'); } } ?> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?> <input type="text" name="mail"> <input type="submit" name="submit"> </form>
8th Jun 2020, 10:44 AM
HNNX 🐿
HNNX 🐿 - avatar
0
HNNX 🐿 Thanks for the heads-up, i just needed to know as I'm getting really curious and excited at the same time Thanks but it's not that important, i just wanted to know if you can do all of it using only HTML
8th Jun 2020, 10:47 AM
Yours.Patrick
Yours.Patrick - avatar