php和mysql中的表单审批问题

rqcrx0a6  于 2021-06-23  发布在  Mysql
关注(0)|答案(0)|浏览(212)

第27行validation.php中有一个错误

$connexion->execute(array($_GET["reponse2"]));

我有两个页面,第一个名为institution.php,没有错误。在第二页(validation.php)的第27行有一个错误

$connexion->execute(array($_GET["reponse2"]));

验证.php:

<?php

$bdd = new PDO('mysql:host=localhost;dbname=inscription;charset=utf8', 'root', '');

$reponse = $bdd->query('SELECT * FROM validation');

while($validation = $reponse->fetch()) {

    echo 'Pseudo: ';
    echo $validation['pseudo'];
    echo ' E-mail: ';
    echo $validation['email'];

    echo '<a href="validation.php?action=accepter&id='.$validation['id'].'">Accepter </a>'; // Il y a une espace pour séparer les liens.
    echo '<a href="validation.php?action=refuser&id='.$validation['id'].'">Refuser</a>';

    echo '<br/>';
}

if(isset($_GET['action']) AND isset($_GET['id'])) {
$action = $_GET['action'];
    if($action == "accepter")
    {
        $id = $_GET['id'];
        $reponse2 = $bdd->prepare("SELECT * FROM validation WHERE id='$id'");
        $connexion->execute(array($_GET["reponse2"]));

        $pseudo = $connexion['pseudo'];
        $passe = $connexion['passe'];
        $email = $connexion['email'];

        $bdd->query("INSERT INTO connexion VALUES('$id', '$pseudo', '$passe', '$email')");

        $bdd->query("DELETE FROM validation WHERE id='$id'");
    }
    elseif($action == "refuser") {
        $id = $_GET['id'];
        $bdd->query("DELETE FROM validation WHERE id='$id'");
    }
}
?>

错误包括:
注意:未定义的变量:connexion在第27行的d:\xampp\htdocs\institution\validation.php中
致命错误:未捕获错误:在d:\xampp\htdocs\institution\validation中对null的成员函数execute()调用。php:27 stack trace:#0{main}在第27行的d:\xampp\htdocs\institution\validation.php中抛出

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题