Hi all
Am doing a php form to add user and the code as below:
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Staff Name:</td>
<td><input type="text" name="STAFFNAME" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Username:</td>
<td><input type="text" name="USERNAME" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Password:</td>
<td><input type="password" name="USERPASSWORD" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Confirm Password</td>
<td><input name="CFMPW" type="password" id="CFMPW" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Add User" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form></td>
The mysql table has these fields:
USER_ID, STAFFNAME, USERNAME, USERPASSWORD
Problem is that how can i implement the 'confirm password' on the form to check on the password keyed by user.
Would greatly appreciate if anyone could give me some pointers. Thanks.
Add User Form - Confirm password
Moderator: General Moderators
-
weblearner
- Forum Newbie
- Posts: 20
- Joined: Wed Dec 29, 2010 9:01 am
-
klevis miho
- Forum Contributor
- Posts: 413
- Joined: Wed Oct 29, 2008 2:59 pm
- Location: Albania
- Contact:
Re: Add User Form - Confirm password
You should add some javascript that checks the password confirmation.
Then to be absolutely sure that the password confirmation is the same as the password, do a php check on the server, in case the user turns disables javascript on his browser.
Then to be absolutely sure that the password confirmation is the same as the password, do a php check on the server, in case the user turns disables javascript on his browser.
Re: Add User Form - Confirm password
first of all use php builtin fuction wordwrap ,asign it to a variable,then explode that variable,explode is also php fuction,which make an array of it,
then using the foreach loop to compare each word with each other,
like
$newtext = wordwrap( here is the text field value, 1, "/", 1);
$array1 = explode('/',$newtext);
repeat the above process for 2nd array
$i=0;
foreach($array1as $a){
if($a==$array2[$i]){
$meh=$meh+1;
}
$i = $i + 1;
}
then using the foreach loop to compare each word with each other,
like
$newtext = wordwrap( here is the text field value, 1, "/", 1);
$array1 = explode('/',$newtext);
repeat the above process for 2nd array
$i=0;
foreach($array1as $a){
if($a==$array2[$i]){
$meh=$meh+1;
}
$i = $i + 1;
}
-
weblearner
- Forum Newbie
- Posts: 20
- Joined: Wed Dec 29, 2010 9:01 am
Re: Add User Form - Confirm password
hey klevis miho, mehran
thanks for helping, had tried both methods.
thanks for helping, had tried both methods.