在选项中选择发布

时间:2014-08-25 18:31:03

标签: php select drop-down-menu

我有一个由mysql查询填充的选项列表,当我点击提交按钮时,我遇到问题。         

include_once 'dropfunc.php';
connect ();
if($_SERVER["REQUEST_METHOD"] == "post")
{
// Create connection
$con=mysqli_connect("localhost","root","","maintenance");

 // Check connection
 if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
    // Do one thing
 }
 else {
    $site_id=$_POST["site_id"];


    $result = mysqli_query($con,"select *  from record where site_id=$site_id");

    mysql_close();
     }
 }
  else
 echo "this is not working"
 ?>

现在我的下拉菜单工作正常,并运行功能和连接页面。现在,我只是想让我的提交工作,然后我将工作,并制作其功能页面。现在,如果我添加了其他"这不起作用"在顶部的所有if语句我可以得到它回应所以我知道IF没有做任何事情。

  <!doctype html>
  <html>
  <div class="box-content">
  <form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
    <div class="control-group">
        <label class="control-label" for="selectError">Select Site</label>

        <div class="controls">

            <select name ="site_id" id="site_id" data-rel="chosen" >
                <?php query() ?>
            </select>
            <input type="submit" value="Submit">
            <?php close() ?>
 </form>
 </div>

 <?php

现在我知道这是有效的,因为我可以自己运行它。

 while($row = mysqli_fetch_array($result)) {

 $luant = $row['luant'];
 $ludish = $row['ludish'];
 $lucable = $row['lucable'];
 $lubrace = $row['lubrace'];

 IF ($luant==1 and $ludish==1 and $lucable==1 and $lubrace==1){
    echo "The page is working";
 }

 else {
    echo "Still working but they don't equal 1";
 }

 }


?>

0 个答案:

没有答案
相关问题