Jump to content

Archived

This topic is now archived and is closed to further replies.

mattbrown

Whats Wrong With This? Simple ?

Recommended Posts

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 :-(

Share this post


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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.