Ok, I got it to work using this:
if ($valid == true) {
$accquery = "UPDATE tblBillID set Password = '".$_POST['NewPassword']."' where BillID = '".$_POST['loginID']."' and Password = '".$_POST['Password']."'";
$accresult = odbc_exec($conn,$accquery);
odbc_close($conn);
echo "<b>Account Has Been Updated</b>";
exit;
}
if ($valid == false) {
echo "<b>Please type your information again, make sure it matches!</b>";}
}
}
?>
<script type="text/javascript">
<!--
var letters='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz '
var numbers='1234567890'
var custom='@.?'
function alpha(e,allow) {
var k;
k=document.all?parseInt(e.keyCode): parseInt(e.which);
return (allow.indexOf(String.fromCharCode(k))!=-1);
}
//form clear function
function clearDefault(el) {
if (el.defaultValue==el.value) el.value = ""
}
// -->
</script>
<form action="" method="post">
<table><tr><td>
Login:</td><td>
<input name="loginID" type="text" maxlength="14" onkeypress="return alpha(event,letters+numbers+custom)" ONFOCUS="clearDefault(this)"></td></tr>
<tr><td>
Password:</td><td>
<input name="Password" type="password" maxlength="28" onkeypress="return alpha(event,letters+numbers+custom)" ONFOCUS="clearDefault(this)"></td></tr>
<tr><td>
Retype Password:</td><td>
<input name="Password2" type="password" width="100" onkeypress="return alpha(event,letters+numbers+custom)" ONFOCUS="clearDefault(this)"></td></tr>
<tr><td>
New Password:</td><td>
<input name="NewPassword" type="text" maxlength="30" onkeypress="return alpha(event,letters+numbers+custom)" ONFOCUS="clearDefault(this)"></td></tr>
<tr><td>
Retype New Password:</td><td>
<input name="NewPassword2" type="text" width="100" onkeypress="return alpha(event,letters+numbers+custom)" ONFOCUS="clearDefault(this)"></td></tr>
<tr>
<td><input type="submit" name="Create" value="Update Account!"></td>
</tr>
</table>
</form>
Now I ran into a different problem. The script works and only updates the database information if the login and password match with the database, but if it doesnt match, no rows get updated in the database, but it still displays the 'Account has been updated' because the query was completed even though it updated no rows.
I realize I should probably have posted this in the MSSQL forum, but it doesnt seem to active so I tried here first.
Any help to get it to display Account has been updated only if rows were changed in the db?