Jump to content

IF statement always testing true


gschimek

Recommended Posts

I'm pulling my hair out trying to figure out a simple problem.  I've got the following PHP code in an HTML page: 

 

 

$shutoff_date = strtotime($wkend_start_date) - 259200; if ($shutoff_date > $todays_date) { $current_month = date("m");$current_year = date("y");$freshman_eligible = 0;if ($current_month >= 2 && $current_month <=7) {		$freshman_eligible = 1;		}if ($current_month <= 7) {		$seniors = $current_year ;		}		else {$seniors = $current_year + 1;		}$juniors = $seniors + 1;$sophomores = $seniors + 2;$freshman = $seniors + 3;echo "HTML Stuff blah, blah, blah";if ($freshman_eligible = 1) {echo "<option value=\"$freshman\">$freshman</option>";}}

 

 

 

The last test to see if $freshman_eligible is equal to 1 is always testing true, and it's actually resetting $freshman_eligible to whatever I put inside the IF statement.  No matter what the variable is set to previously, it will reset to whatever I test for in the last section, and hence always tests true.

 

I thought maybe it was an issue with scope, but I'm not sure what the issue would be or how to resolve it.

 

 

What am I missing???

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.