Jump to content

[SOLVED] IF STATEMENT/VARIABLE HELP!!!


burkee25

Recommended Posts

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/131946-solved-if-statementvariable-help/
Share on other sites

If you use method="post" you use $_POST to read the data.

This sends the data from the form to the server in packets of data.

 

If you use method="get" you use $_GET to read the data.

This sends the data from the form to the server appended onto the URL.

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.