4

私はphpが初めてです。次のように、単純なユーザーとパスワードのログインフォームを作成しました。

if(isset($_POST['posted'])){

    $name= $_POST['name'];
    $pass= $_POST['pass'];

    if(!is_string($name))
    {
    echo "please enter name in alphabets";
    }
    else if($name=='muneeb' && $pass=='abcd')
    {
        header("location:1st.php");
    }
    else
    {
        echo "you entered wrong password";
    } }

ただし、実行される条件は 1 つだけです。3つすべてを実行したい。

4

2 に答える 2

0

そのはず

if(isset($_POST['posted']))
    {

        $name= $_POST['name'];
        $pass= $_POST['pass'];

        if(is_numeric($name))
        {
            echo "please enter name in alphabets";
            exit;
        }

        if($name=='muneeb' && $pass=='abcd')
        {
            header("location:1st.php");
            exit;
        }
        else
        {
            echo "you entered wrong password";
            exit;
        } 
    }
于 2013-03-30T10:19:24.397 に答える