0

我正在尝试通过一个简单的表单来更新用户级别,但它向我显示未定义的索引并且没有更新级别有人会帮助我这样做吗?

<h3>Update User Level</h3>
<form action="" method="POST">
UserID:<br/>
<input type="text" name="upduser" maxlength="30"> <br/>
Designation code:<br>
<?php
//require 'config.php';
$options = '';
$filter=mysql_query("select`user_dsgntn_code` from `hr_user`");
while($row = mysql_fetch_array($filter)) {
    $options .="<option>" . $row['user_dsgntn_code'] . "</option>";
}
            $dropdown="<form id='designation' name='designation' method='POST' action=''>
                <select name='updlevel' onchange='showUser(this.value)'>
                  " . $options . "
                </select>
            </form>";
        echo $dropdown;
        //do_alert("$options");
        ?>
<br>
<input type="submit" value="Update Level">
</form>
<?
//require 'config.php';

if ( isset( $_POST['upduser'] ) && ! empty ( $_POST['upduser'] )&&
isset ($_POST['updlevel']));
{
$updtuser=$_POST['upduser'];
$updtlevel=$_POST['updlevel'];
$sql_upd="update `hr_user` set user_dsgntn_code='$updtlevel' WHERE user_id='$updtuser'";
$result = mysql_query($sql_upd) or die(mysql_error());
}
4

1 回答 1

0

删除<select>.

<h3>Update User Level</h3>
<form action="" method="POST">
UserID:<br/>
<input type="text" name="upduser" maxlength="30"> <br/>
Designation code:<br>
<?php
//require 'config.php';
$options = '';
$filter=mysql_query("select`user_dsgntn_code` from `hr_user`");
while($row = mysql_fetch_array($filter)) {
    $options .="<option>" . $row['user_dsgntn_code'] . "</option>";
}
            $dropdown="<select id='designation' name='updlevel' onchange='showUser(this.value)'>
                  " . $options . "
                </select>";
        echo $dropdown;
        //do_alert("$options");
        ?>
<br>
<input type="submit" value="Update Level">
</form>
于 2013-02-01T07:00:15.380 回答