my php code looks like this
<?php
$host="localhost"; // Host name
$username=""; // Mysql username
$userpassword=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="adduser"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$userpassword")or die("Cannot connect to the Data Base");
mysql_select_db("$db_name")or die("Cannot select DB");
$sql="select uid,concat(left(firstname,1),lastname) as username from adduser order by firstname;";
$result=mysql_query($sql)or die(mysql_error());
?>
<select size ="10" name="seluser" style="width:150" class=NormalFont>
<option value="0">-Select User from List-</option>
<?php
while ($row = mysql_fetch_array($result)) {
//$count=mysql_num_rows($result);
$username = $row["username"];
?>
<option value =" <?php echo $row['uid']; ?>"><?php echo "$username";?></option>
<?php
}
?>
</option>
</select>
<input type="submit" class="NormalButton" value=" Delete " onClick="doSubmit(seluser)" id=button1 name=button1>
<input type="button" class="NormalButton" value=" Cancel " onClick="javascript:location.href = './users.php'" id=button2 name=button2>
<script language="javascript">
function doSubmit(frm)
{
if (deluser.seluser.selectedIndex < 0 )
{
alert("Select a User to delete");
}
else
{
frm.flag.value = 1;
frm.action = "./userlist.php";
//frm.submit();
callVBconfirm()
}
}
function nextPage()
{
deluser.flag.value = 1;
deluser.action = "./userlist.php";
deluser.submit();
}
</script>
<script language="VBScript">
function callVBconfirm()
ans = MsgBox("Are you sure want to delete this user account?",vbYesNo)
if (ans=6) then
nextPage()
end if
end function
</script>
my table contains
table name:adduser
fields
1.uid
2.firstname
3.lastname