Page 1 of 1
Re: If statement not working as expected
Posted: Tue Apr 14, 2015 11:01 pm
by requinix
Code: Select all
if (!$user_theme == $_SESSION["user_theme"]) {
What that says is to take $user_theme, negate it, then compare with the session data.
Want a not-equals? Use the not-equals sign.
Code: Select all
if ($user_theme != $_SESSION["user_theme"]) {
Re: If statement not working as expected
Posted: Wed Apr 15, 2015 2:24 pm
by requinix
Oh.
You didn't name your select. Giving it an ID is a different thing.
Code: Select all
<select id="user_theme" name="user_theme">
Re: If statement not working as expected
Posted: Wed Apr 15, 2015 6:44 pm
by requinix
Wargog wrote:Ugh, I knew there was something wrong, I keep forgetting when to use id, name, class etc.
The id is completely client-side. You can use it for anchors (#foo) and Javascript.
The name can be used client-side too with Javascript, but its most common purpose is to give form fields the name they should use with submitting the form, and thus how you receive their data.
The class is primarily for CSS but can be useful with Javascript too.
Wargog wrote:Ok, it's receiving the data and prints a blank page and doesn't write the result to SQL, but hey, no errors right?
Since the error messages work, there may a fatal error somewhere. Check your error logs. I also suggest turning on display_errors (for your development environment only).