문제

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.

    -
도움이 되었습니까?

해결책

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

다른 팁

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');
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top