【发布时间】:2015-01-14 18:14:11
【问题描述】:
为什么我在声明变量时得到一个未定义的索引?目前正在使用引导程序。
<?php
mysql_connect("localhost", "root", "1234") or die(mysql_error());
mysql_select_db("newitems") or die(mysql_error());
$up = $_POST['update'];
mysql_query("UPDATE announcements SET content = $up");
?>
<div class="well well-small text-center">
<h3>Create an Announcement / Reminder:<br>
<form class="form-group" id="form-mahasiswa" method="POST" action="ad_post.php">
<div class="control-group">
<div class="controls">
<textarea id="update" name="update"></textarea><br>
<button id="annbtn" class="btn btn-success">Update Announcement</button>
</div>
</div>
【问题讨论】:
-
您正在使用变量 $_POST['update'];在您发布表单之前不会设置。
-
我需要做什么?
标签: php variables indexing undefined