Joined: 12 Nov 2002
Posts: 82
Location: Yarm, England
Posted:
Mon Feb 16, 2004 9:29 pm (20 years, 2 months ago)
I want to do this, but PHP doesn't do continue for if statements. Any idea how I canget it to leave the loops?
Code:
//Handle submitted data
if($save=="yes"){
//Is current password correct
if(md5($currentpass)!=$userdata[password]){
debug(md5($currentpass)." != ".$userdata[password]);
$error="Your current password is not correct";
continue 2; //This should leave two loops
}
//Do two new passwords match
if($fpass!=$fpass2){
$error="You entered two different new passwords";
continue 2;
}
}
Thanks
________________________________ Iyonix
Aquilo Junior WebHelper
Joined: 18 Feb 2004
Posts: 1
Posted:
Wed Feb 18, 2004 8:58 am (20 years, 2 months ago)
continue should be used in a loop
like this will print even numbers
Code:
for($i=0; $i<10; $i++)
{
if ($i%2) continue;
echo $i;
}
for things like
Code:
if($fpass!=$fpass2){
$error="You entered two different new passwords";
continue 2;
}
I would go with die($error) or echo $error then exit;
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.