我正在编辑php和mysql的表单模板,并添加了变量“ firstname”和“ lastname”。但是,打开页面后会显示错误消息:
“通知:未定义的变量:第19行的C:\ wamp64 \ www \ Guyana_City_Guide \ register.php中的名字调用堆栈#TimeMemoryFunctionLocation 10.0027403056 {main}()... \ register.php:0”>“ >
该消息的姓氏也相同,除了位于第23行。
`
REGISTER.PHP
<div class="input-group">
<label>First Name</label>
19. <input type="text" name="firstname" value="<?php echo $firstname; ?>">
</div>
<div class="input-group">
<label>Last Name</label>
23. <input type="text" name="lastname" value="<?php echo $lastname; ?>">
</div> `
`VARIABLE DEFINITION
$firstname = mysqli_real_escape_string($db, $_POST['firstname']);
$lastname = mysqli_real_escape_string($db, $_POST['lastname']);
`