根据选项选择更新数据库

时间:2016-09-12 18:06:44

标签: php forms html-select html-form

我无法弄清楚我的代码有什么问题。我是php的新手,所以有人可以告诉我我做错了什么吗?

这是表格:

/etc/environment

这就是表单动作。此表单将以第一种形式处理任何输入数据:

<center><br/><h2>Update Form</h2></center>
<div id="login">
    <fieldset>
        <legend><h3>Update Form</h3></legend>
<h4 style="color:pink;"><?php global $nam; echo $nam;?> </h4> 
<?php global $error; echo $error;?>                  
        <!-- the login form-->
<form action='login_reg_action.php' method='post' id='myform'>
            <div class="login">
            <table width="400px">

<tr>
<td><label>Username</label></td>
<td colspan="2"><span class="style8">
 <div align="center">
      <?php
      include 'connection.php';
      $sql = 'SELECT * FROM login_1 ORDER BY username';
      $sele=mysqli_query($conn,$sql);
      ?>
      <select name="login_id" style="width:250px; height:34px; border:1px solid #336666;">
        <option required="required" value="000" > [SELECT STUDENT]</option>
        <?php
       while($numu=mysqli_fetch_array($sele))
       {
      ?>
        <option required="required" value="<?php echo $numu['login_id'];?> ">  <?php echo $numu["login_id"];echo'  -  ';echo $numu["username"] ?>   </option>
        <?php
      }
      ?>
      </select>
      </label>
      </div>
  </td>

  </tr>
  <tr>
 <td><label>Rank</label></td>
 <td><select name="rank" id="rank" style="width:250px; height:34px; border:1px solid #336666;">
 <option value="000">Choose user rank</option>
 <option value="student">Student</option>
 <option value="candidate">Candidate</option>
 <option value="administrator">Administrator</option>
 </select></td>
 </tr>
 <tr><td colspan="2" align="left"><input type="submit" name="submit" value="Update" style="width:100px; height:34px; border:1px solid #336666; border-radius:4px;"></td></tr>
             </table>
            </div>
 </form>

0 个答案:

没有答案