JREAM Posted August 25, 2008 Share Posted August 25, 2008 How come this doesn't write the if($write == false) statement when it fails? If the submit button is clicked and it doesn't process through, i can't get it to say it didn't go, if I do "else" it all appears on the same page. if ($_POST['submit'] && $pw1 == $pw2 && strlen($pw1) >= 4) { $thefile = 'pw.php'; // Rename to PHP $fp = fopen($thefile, 'w'); // for encoding $loginwrite = base64_encode($login); $passwrite = base64_encode($pw1); // do the write $write = fwrite($fp, $loginwrite . '|' . $passwrite); if($write == false) { echo 'Error writing'; echo '⋅ Password Must be atleast 4 Characters <br />⋅ Password must match Verified Password'; } if($write == true) { echo '<strong>Password Saved & Changed</strong>'; } fclose($fp); } Link to comment https://forums.phpfreaks.com/topic/121162-more-troubles-with-else-write/ Share on other sites More sharing options...
Drezard Posted August 25, 2008 Share Posted August 25, 2008 Just a wild suggestion but: if(!fwrite($fp, $loginwrite . '|' . $passwrite)) { echo 'Error writing'; echo '⋅ Password Must be atleast 4 Characters ⋅ Password must match Verified Password'; } else { echo '<strong>Password Saved & Changed</strong>'; } Link to comment https://forums.phpfreaks.com/topic/121162-more-troubles-with-else-write/#findComment-624683 Share on other sites More sharing options...
Drezard Posted August 25, 2008 Share Posted August 25, 2008 Oh... and make sure u CODE /CODE Your code! Daniel Link to comment https://forums.phpfreaks.com/topic/121162-more-troubles-with-else-write/#findComment-624684 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.