Frage

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.

    -
War es hilfreich?

Lösung

<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';}}">

Andere Tipps

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');
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top