Jump to content


Photo

Whats Wrong With This? Simple ?


  • Please log in to reply
2 replies to this topic

#1 mattbrown

mattbrown
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 24 May 2006 - 01:48 PM

Hi
ok im just writing a lil function to deal with changing a password and i think ive gone brain dead

the function gets 3 variables passed to it and i want it to check them like this

1 are variables $old, $new1, $new2 set
2 do variables $new1 and $new2 match
if so { do my stuff }

so i put

if((isset($old && $new1 && $new2))&&($new1 == $new)) {

i know ive made a silly mistake could somebody please put me out of my misery, maybe ive been sitting at this laptop too long :-(

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 24 May 2006 - 01:51 PM

You dont need to check if there set or not. If you call the function without them, you weill get an error.
function changepass($old,$new,$new2) {
  if (!$new == $new2) {
    return false
  }
  // do update
}


#3 mattbrown

mattbrown
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 24 May 2006 - 01:57 PM

so at present i have

in the page

$change_pass_result changepass($oldfromform, $new1fromform ,$new2fromform)

and if one of them are not set then $change_pass_result will be false?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users