What's wroung with this code?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pahn0624
Forum Newbie
Posts: 1
Joined: Fri Sep 15, 2006 2:46 pm

What's wroung with this code?

Post by pahn0624 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


This code comes from previous form and everything seems to work, however, the varialbe $month is always September and the Variable $month2 is always October no matter what I change the form to.

Form;
[syntax="html"]						<select name="month">
						<option selected value="select_month">Select Month
						<option value="September">September
						<option value="October">October
						<option value="November">November
						<option value="December">December
						<option value="January">January
						<option value="February">February
						<option value="March">March
						<option value="April">April
						<option value="May">May
						<option value="June">June
						</select>
PHP;[/syntax]

Code: Select all

<?php
$month = $_POST['month'];
if ($month ='September'){
	$month2 = 'October';
	$year = '2006';
}elseif ($month='October'){
	$month2 = 'November';
	$year = '2006';
}elseif ($month='November'){
	$month2 = 'December';
	$year = '2006';
}elseif ($month='December'){
	$month2 = 'January';
	$year2 = '2007';
}elseif ($month='January'){
	$month2 = 'February';
	$year2 = '2007';
}elseif ($month='February'){
	$month2 = 'March';
	$year2 = '2007';
}elseif ($month='March'){
	$month2 = 'April';
	$year2 = '2007';
}elseif ($month='April'){
	$month2 = 'May';
	$year2 = '2007';
}else
	$month2 = 'June';
	$year2 = '2007';
?>

Thanks in advance...


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

= versus ==
assignment versus equality
Post Reply