PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi everyone
my problem is :
i have 3 input field 1- username, 2- pass, 3- repass
so i want to edit my username only , and when i edit my username also my pass edit automatically because my input field is empty
and with md5 make the encrypt to empty field
this is the code :
<form action="empty.php" method="post">
<input type="password" name="pass" /><br />
<input type="password" name="repass" /><br />
<input type="submit" name="submit" />
</form>
<?php
if(isset($_POST['submit'])){
// Trims all string $_POST values
foreach($_POST as $key=>$val) { if (is_string($val)) { $_POST[$key] = trim($val); } }
if ($_POST['pass']=='' && $_POST['repass']=='') {
// Both fields were left empty, so assume only username is being changed
}
else {
// Something was entered, so do some checking to make sure valid size / repass=pass
}
}
?>
(also be prepared for the discussion of that you should use something stronger than md5, and that using md5 is not actually encryption, both which are valid points to look into before you use this in production)