Link to home
Start Free TrialLog in
Avatar of axessJosh
axessJosh

asked on

Display text based on POST variable

Perhaps I'm having a brain lapse but i cannot get a variable to work.  I want to post text based on what the POST variable is.  I am using the code below.

 
<?php
			// Get Quarter to show report selected 
			
			if($_POST['qSelect'] = '1') { $quart = "First Quarter"; }
			elseif($_POST['qSelect'] = '2') {$quart = "Second Quarter"; }
			
			?>

Open in new window


I am then using the $quart variable to display the user's choice.
ASKER CERTIFIED SOLUTION
Avatar of Rik-Legger
Rik-Legger
Flag of undefined image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
rik is right, your problem is the = you used in the if statement, instead of the ==. Remember in php = is for assigning values to a variable, == is for comparison. So what you are doing in the if statement is assigning first 1 to $_POST['qSelect'] then assigning it 2 instead of checking the values.