forumnz Posted January 3, 2007 Share Posted January 3, 2007 What should go where "here" is to complete this code - if no new password is entered the password on the database wont become blank... at the moment it does??[code]if (empty($_POST['password'])) { $password = false;} else { $password = base64_encode($_POST['password']);}[/code] Link to comment https://forums.phpfreaks.com/topic/32659-what-should-go-here/ Share on other sites More sharing options...
mmarif4u Posted January 3, 2007 Share Posted January 3, 2007 Try out thisPut this code after ur array in which u defined the $required_fields$required_fields define ur fields like this[code]$required_fields = array( 'name','password','username', '', 'email');[/code]Than add this code[code]foreach ($required_fields as $field) {if (!isset($_POST[$field]) || empty($_POST[$field]))error("One or more required fields were left blank. \\n Please fill them in and try again."); }[/code] Link to comment https://forums.phpfreaks.com/topic/32659-what-should-go-here/#findComment-151990 Share on other sites More sharing options...
forumnz Posted January 3, 2007 Author Share Posted January 3, 2007 Thanks but this page is for editing their profile - if they dont want a new username then they dont need to fill it in... the problem with this though is that if they dont fill it in, it becomes blank on the database Link to comment https://forums.phpfreaks.com/topic/32659-what-should-go-here/#findComment-151991 Share on other sites More sharing options...
mmarif4u Posted January 3, 2007 Share Posted January 3, 2007 ok u want that a new user create a username... but he or she cannot want to createthan not go to database field...where u define[code]$password = false;[/code] Link to comment https://forums.phpfreaks.com/topic/32659-what-should-go-here/#findComment-151997 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.