Below is a small sample of the code. A problem I was having was that the entire loop would execute even after it encountered an error. This was not acceptable because the bottom of the loop ends by resetting the error to 0.
I tried a "do {} while;" loop but that did not work. The below code does work, but I had to add a break to every single line of code. Is there a better way to do this?
Code: Select all
<?php
// ---------- D A T A V A L I D A T I O N ---------- //
while ($PostedDataError == -1)
{
// -------------------- CHECK MAXIMUM LENGTHS -------------------- //
if (strlen($_POST['Password1']) > 24) {$PostedDataError = 45; break;}
if (strlen($_POST['Password2']) > 24) {$PostedDataError = 46; break;}
$PostedDataError = 0;
}
?>