“PAGE PHP LOAD SELECT FROM URL” Réponses codées

PAGE PHP LOAD SELECT FROM URL

<?php
    if(isset($_POST['type'])) {
        switch($_POST['type']) {
            case 1:
                header("Location: ssgt.php");
                break;
            case 2:
                header("Location: tsgt.php");
                break;
            case 3:
                header("Location: msgt.php");
                break;
        }
    }
?>
<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>MCQ Questions</title>
    </head>
    <body>
        <form method="post" enctype="multipart/form-data">
            Select rank :
            <select name="type" id="type" onchange="this.form.submit()">
                <option value="">Select rank...</option>
                <option value="1">SSgt</option>
                <option value="2">TSgt</option>
                <option value="3">MSgt</option>
            </select>
        </form>
    </body>
</html>
Liyang Yu

PAGE PHP LOAD SELECT FROM URL

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>MCQ Questions</title>

</head>
<body>


<form method="post" action="mcq.php" enctype="multipart/form-data">
    <?php
    if(isset($_POST['type']))
    {

        if(strcmp($_POST['type'],"1") == 0)
        {
            header("Location: ssgt.php");
        }
        elseif(strcmp($_POST['type'],"2" == 0))
        {
            header("Location: tsgt.php");
        }
        elseif(strcmp($_POST['type'],"3" == 0))
        {
            header("Location: msgt.php");
        }
    }

    ?>

    <h2>Lets add a question, Select a rank for which you want to add a question.</h2>
<br><br>
Select rank : 

<select name="type" id="type"  onchange="this.form.submit()">


    <option value="1">SSgt</option>
<option value="2">TSgt</option> 
<option value="3">MSgt</option> 
</select>

</form>
</body>
</html>
Liyang Yu

Réponses similaires à “PAGE PHP LOAD SELECT FROM URL”

Questions similaires à “PAGE PHP LOAD SELECT FROM URL”

Plus de réponses similaires à “PAGE PHP LOAD SELECT FROM URL” dans PHP

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code