<input class="redirect" onkeydown="if (event.keyCode == 13){if(this.value=='A80G'){window.location.href='page1.html';};if(this.value=='B6T4'){window.location.href='page2.html';}}">
I want to redirect user to a specific page upon a code in input [closed]
-
19-07-2023 - |
Pregunta
I have an input: <input type="text" class="redirect"></input>
And when the user types A80G
, I want him/her to be redirected to page1.html
, and when the user types B6T4
, I want him/her to be redirected to page2.html
.
Can someone suggest me a way?
My humblest thankfulness.
-
-
Solución
Otros consejos
you can use switch case for this
$value = $_POST['input'];
switch ($value) {
case 'A80G':
header('location:page-1.html');
break;
case 'B6T4':
header('location:page-2.html');
break;
default:
header('location:page-1.html');
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow