Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/272.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Issue$\u GET为空_Php_Get - Fatal编程技术网

Php Issue$\u GET为空

Php Issue$\u GET为空,php,get,Php,Get,我的代码有问题: <header class="page-header"><h1>Ajouter une salle</h1></header> <div class="container"> <div class="jumbotron"> <form action="creerSalle.php" method="get"> <div c

我的代码有问题:

    <header class="page-header"><h1>Ajouter une salle</h1></header>
    <div class="container">
      <div class="jumbotron">
        <form action="creerSalle.php" method="get">
            <div class="form-group">
                <label for="numSalle">Numero salle :</label>
                <input type="number" class="form-control" id="numSalle"/>
            </div>

            <div class="form-group">
                <label for="numEtage">Numero étage (0 pour RDC) :</label>
                <input type="number" class="form-control" id="numEtage"/>
            </div>

            <div class="form-group">
                <label for="numBatiment">Numero bâtiment :</label>
                <input type="number" class="form-control" id="numBatiment"/>
            </div>

            <div class="form-group">
                <label for="typeSalle">Type salle :</label>
                <input type="text" class="form-control" id="typeSalle"/>
            </div>

            <div class="form-group">
                <label for="capacite">Capacite salle :</label>
                <input type="range" class="form-control" id="capacite" min="1" max="100"  onchange="updateTextInput(this.value);"/>
                <input type="text" id="textInput" value="" class="textRange" disabled/>
            </div>

            <input type="submit" value="Valider"/>

        </form>

        <?php
            ini_set('display_errors', 'On');
            error_reporting(E_ALL);
            print_r($_GET);

        if(!empty($_GET))
        {

            $pdo = new PDO('mysql:host=localhost;dbname=projettutore', "root", "");
            $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            $stmt = $pdo->prepare("INSERT INTO salle(id,numSalle,numEtage,numBatiment,typeSalle,capacite,nbOccupant) VALUES (?,?,?,?,?,?,0)");

            $stmt->bindParam(1,$_GET["numSalle"],PDO::PARAM_INT);
            $stmt->bindParam(2,$_GET["numSalle"],PDO::PARAM_INT);
            $stmt->bindParam(3,$_GET["numEtage"],PDO::PARAM_INT);
            $stmt->bindParam(4,$_GET["numBatiment"],PDO::PARAM_INT);
            $stmt->bindParam(5,$_GET["typeSalle"],PDO::PARAM_STR,20);
            $stmt->bindParam(6,$_GET["capacite"],PDO::PARAM_INT);

            if($pdo->exec($sql)){
                echo "Insertion réussie !";
            }
            else
                echo "ERROR !";
        }   

        ?>

      </div>
    </div>
ajourne salle
第一名:
数量(0倾注RDC):
数字b–timent:
类型salle:
能力销售:
$\u GET变量为空,URL没有?在里面。。 我没有错误,我的数据库中也没有insert。
我想不出问题出在哪里,您能帮帮我吗?

使用$\u GET要求输入字段具有name属性,因此

 <input type="number" class="form-control" id="numSalle"/>

你会的

 <input type="number" class="form-control" id="numSalle" name="numSalle"/>

为表单字段添加
name
属性

     <input type="text" id="textInput" value="" class="textRange" name="FEILDNAME" disabled/>


注意:如果您添加禁用的属性
$\u GET
变量不包含此字段的值

,则需要在每个输入标记中放置
名称
属性,以便GET方法能够理解要获取的内容。它工作正常,谢谢!