jimfog Posted August 27, 2015 Share Posted August 27, 2015 Take a look at this code.... var_dump($_POST['email']); if(($_POSΤ['email'])) { var_dump($_POST['email']); } The above code is found in a script which accepts ajax requests from a form...one field of which is the e-mail.... The strange part: While vardumping $_POST['email'] gives the value of it... Inside the IF statement the same variable gets to be undefined...how can that be? Link to comment Share on other sites More sharing options...
dsonesuk Posted August 27, 2015 Share Posted August 27, 2015 It should have returned null with undefined index, IF no value has been set at all for 'email', the var_dump if condition function should not run for same reason that $_POST['email'] is not set and would be underfined Link to comment Share on other sites More sharing options...
justsomeguy Posted August 27, 2015 Share Posted August 27, 2015 In the above code the 2 var_dump statements, if both of them run, will never display different data. If that's not the code you're actually working with then post the code you're actually working with. It should be obvious that in that hypothetical the value never changes. Link to comment Share on other sites More sharing options...
jimfog Posted August 28, 2015 Author Share Posted August 28, 2015 I found what the problem was...it was just a typo...there was a space between the dollar sign and the underscore. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now