burkee25 Posted November 8, 2008 Share Posted November 8, 2008 Hi lads, Im wrecking my head trying to solve this code! any help would be much appreciated! So I have a html page, with an option to pick your favourite team, and then on the php page i want to show a picture of the selected team! This is from the original html page: <body> form action="phpassign.php" method="post"> <!--Form for favourite team --> <h3>Selcet your favourite team</h3> <select name="team" id="team"> <option $team value="Mancheter United">Man Utd</option> <option value="Asrenal">Asrenal</option> <option value="Chelsea">Chelsea</option> <option value="Liverpool">Liverpool</option> </select> </body> Then I Have the PHP file: <body> <?php $team = $_GET['team']; if ( $team== "Manchester United" ) { echo "<img src=man_utd.jpg><br />"; } echo "Welcome to my homepage!"; echo $_POST['team']; echo ".<br /> "; echo $_POST['color']; ?> </body> </html> Any help would be great! Link to comment https://forums.phpfreaks.com/topic/131933-solved-if-statementvariable-help/ Share on other sites More sharing options...
Jeremysr Posted November 8, 2008 Share Posted November 8, 2008 Change this: $team = $_GET['team']; To this: $team = $_POST['team']; Link to comment https://forums.phpfreaks.com/topic/131933-solved-if-statementvariable-help/#findComment-685431 Share on other sites More sharing options...
BillyBoB Posted November 8, 2008 Share Posted November 8, 2008 Wrong forum too. How did this have anything to do with math? Link to comment https://forums.phpfreaks.com/topic/131933-solved-if-statementvariable-help/#findComment-685456 Share on other sites More sharing options...
burkee25 Posted November 8, 2008 Author Share Posted November 8, 2008 oh your right i didnt even notice, sorry. i guess i'll repost it then in the right place. Thanks for the reply Jeremysr but that didnt work Link to comment https://forums.phpfreaks.com/topic/131933-solved-if-statementvariable-help/#findComment-685536 Share on other sites More sharing options...
Mchl Posted November 8, 2008 Share Posted November 8, 2008 <option $team value="Mancheter United">Man Utd</option> And what is $team doing here exactly? Also note it says Mancheter, and I believe city's name is Manchester (not to mention it will not match a condition in your php script) Link to comment https://forums.phpfreaks.com/topic/131933-solved-if-statementvariable-help/#findComment-685544 Share on other sites More sharing options...
burkee25 Posted November 8, 2008 Author Share Posted November 8, 2008 Thank you so much! Spent ages trying to figure out why it wouldnt work.....and it turns out to be a simple spelling mistake!!!! kick in the teeth! Thanks! Link to comment https://forums.phpfreaks.com/topic/131933-solved-if-statementvariable-help/#findComment-685548 Share on other sites More sharing options...
Mchl Posted November 8, 2008 Share Posted November 8, 2008 Changing $_GET to $_POST was also necessary. Link to comment https://forums.phpfreaks.com/topic/131933-solved-if-statementvariable-help/#findComment-685552 Share on other sites More sharing options...
Barand Posted November 8, 2008 Share Posted November 8, 2008 on the subject of spelling, "Asrenal" has an "arse" in it. Link to comment https://forums.phpfreaks.com/topic/131933-solved-if-statementvariable-help/#findComment-685611 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.