我有一个很小的问题,即将变量发送到另一个页面会产生未定义的变量。
第1页:
<form name= "updateProfiel" method="POST" action="index.php?page=updateProfiel">
<input required type="text" name="voornaam" value="<?php echo $result['voornaam']; ?>"/>
<input required type="text" name="achternaam" value="<?php echo $result['achternaam']; ?>"/>
<input required type="text" name="adres" value="<?php echo $result['adres']; ?>"/>
<input required type="text" name="postcode" value="<?php echo $result['postcode']; ?>"/>
<input required type="text" name="woonplaats" value="<?php echo $result['woonplaats']; ?>"/>
<input required type="email" name="email" value="<?php echo $result['email']; ?>"/>
<input required type="password" name="password" placeholder="password"/>
<input type="hidden" name="submit" value="true" />
<input type="submit" id="submit" value=" Update " />
<a href="index.php?page=welkom">Annuleren</a>
</form>
第2页: (页面名称为updateProfiel.php)
$voornaam = htmlspecialchars($_POST["voornaam"]);
$achternaam = htmlspecialchars($_POST["achternaam"]);
$adres = htmlspecialchars($_POST["adres"]);
$postcode = htmlspecialchars($_POST["postcode"]);
$woonplaats = htmlspecialchars($_POST["woonplaats"]);
$email = htmlspecialchars($_POST["email"]);
$password = htmlspecialchars($_POST["password"]);
$password = password_hash($password, PASSWORD_BCRYPT);`
我使用phpinfo();
查看变量是否从第1页发送到第2页,并且它们在那里:
但是,如果我尝试将它们设置为变量并使用它们,那么它们就是未定义的! 有谁知道这里发生了什么?
答案 0 :(得分:0)
这非常令人尴尬。 未定义的变量实际上并未定义。源页面就是这么说的。
问题出在其他地方:')...感谢大家的帮助!
Ps:问题在于数据库的一个SQL查询缺少两个括号..是的。