注意:未定义的索引:第11行的E:\ xampp \ htdocs \ qrcodeee \ qrcodeee.php中的ID
注意:未定义的索引:第12行的E:\ xampp \ htdocs \ qrcodeee \ qrcodeee.php中的名称
注意:未定义的索引:第13行的E:\ xampp \ htdocs \ qrcodeee \ qrcodeee.php中的数字
通知:未定义的索引:第14行的E:\ xampp \ htdocs \ qrcodeee \ qrcodeee.php中的年份
我是通过从数据库中获取数据来生成qrcode的,但是当我单击qr code的下载按钮时,该属性声明为undefined。
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" >
<?php
include 'includes/connection.php';
$conn = OpenCon();
$sql = "select * from phonebook";
$result = mysqli_query($conn,$sql);
while ($row=mysqli_fetch_array($result))
{ ?><!--open of while -->
<span>ID:</span> <?php echo $row['id']; ?>
<span>Name:</span> <?php echo $row['Name']; ?>
<span>Number:</span> <?php echo $row['number']; ?>
<span>Class:</span> <?php echo $row['year']; ?>
<div class="form-group">
<input type="submit" name="submit" class="btn btn-primary submitBtn" style="width:20em; margin:0;" />
</div>
<?php
} //close of while
?>
</form>
if(isset($_POST['submit']) ) {
$tempDir = 'temp/';
$id = $_POST['id'];
$Name = $_POST['Name'];
$number = $_POST['number'];
$year = $_POST['year'];
$filename = getUsernameFromEmail($id);
$codeContents = 'mailto:'.$id.'?id='.urlencode($id).'&Name='.urlencode($Name).'&number='.urlencode($number).'&year='.urlencode($year);
QRcode::png($codeContents, $tempDir.''.$filename.'.png', QR_ECLEVEL_L, 5);
}`