我如何发布约会的价值?

时间:2014-07-14 20:50:12

标签: php post

if(isset($ _ POST [' update'])){         $ UpdateQuery =" UPDATE约会SET appointmentstatusid =' $ _ POST [appointmentstatusid]'在哪里,appointmentstatusid =' $ _ POST [appointmentstatusid]'&#34 ;;         的mysql_query($ UpdateQuery);         };

$query2 = "SELECT * from appointmentstatus"; 
$result = mysql_query($query2);
echo "<select name=appointmentstatusid>"; 
while ($line = mysql_fetch_array($result)) {
    echo "<option value=".$line['appointmentstatusid'].">"; 
    echo $line['appointmentstatus'];
    echo "</option>";
}
echo $_POST["appointmentstatusid"];
echo "</select>";

我想发布appointmentstatusid,但在运行时,我收到undefined index appointmentstatusid错误(引用$_POST[]内的错误),但我不确定原因。不确定我的更新中的where子句是否有问题。

2 个答案:

答案 0 :(得分:1)

如果我理解你,你需要将$ line [&#39; appointmentstatus&#39;]的值传递给另一个带有表单POST的页面。这是对的吗?

如果是,你需要做

     <form action="http://target.url" name="" id="" method="POST">
<input type='hidden' name='appointment_status' value='$line['appointmentstatus']'>
</form>
<script type="text/javascript">
  $(document).ready(function() {
    window.document.forms[0].submit();
  });
</script>

答案 1 :(得分:0)

取出您在问题中输入的代码中的echo $_POST["appointmentstatusid"];,然后提交表单。在您发布表单的页面上,您应该在$_POST["appointmentstatusid"]变量中有一个值。