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
https://forums.phpfreaks.com/topic/215523-if-statement-always-testing-true/
Share on other sites

Archived

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

×
×
  • 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.