the problem which i face is that when i press the save button
CODE
<select name=seluser class=NormalFont >
<option value="0">-Select User from List-</option> <?php while ($row = mysql_fetch_array($result)) {
$username = $row["username"];
?>
<option value =" <?php echo $row['usrid']; ?>"><?php echo "$username";?></option>
<?php
}
?>
</option>
</select>
</td>
<?php
$use = $_POST['seluser'];
$pass = $_POST['txtpass'];
$confpass = $_POST['txtconfpass'];
$psql = "INSERT INTO loginuser VALUES ('usrid=\"$use\"','','','','$pass','$confpass');";
$presult = mysql_query($psql)or die(mysql_error());
?>
Password<input type="password" name="txtpass" size="25" class="NormalTextBox" value="" maxlength=20>
Comfirm Password<input type="password" name="txtconfpass" size="25" class="NormalTextBox" value="" maxlength=20>
<input type="button" class="NormalButton" value=" Save " onClick="doSubmit(edituser)" id=button1 name=button1>
<input type="button" class="NormalButton" value=" Cancel " onClick="java script:location.href = './users.php'" id=button2 name=button2>
<script language="javascript">
function IsEmpty(MyValue)
{
if (MyValue.replace(/\s+/g,"").length<=0)
{
return true;
}
else
{
return false;
}
}
function doSubmit(form)
{
if(form.seluser.selectedIndex == 0 )
{
alert("Select the user name");
form.seluser.focus();
}
else if (IsEmpty(form.txtpass.value))
{
alert("Enter the Password");
form.txtpass.focus();
}
else if (IsEmpty(form.txtconfpass.value))
{
alert("Enter the Confirm Password");
form.txtconfpass.focus();
}
else if (form.txtpass.value != form.txtconfpass.value)
{
alert("Mismatch of Password and Confirm Password");
form.password.focus();
}
else
{
form.flag.value = "1";
form.action = "./edituser.php";
form.submit();
}
}
function Seluser(frm)
{
if(frm.seluser.selectedIndex == 0 )
{
}
else
{
frm.flag.value = "2";
frm.action = "./edituser.php";
frm.submit();
}
}
</script>
<u>My Table</u>
table name:loginuser
fields
1.usrid
2.fname
3.lname
4.usrname
5.pass
6.confpass
in the table the value is getting updated twice with a new usrid