PHP Homework
Simple form that uses php an return values. Some of the conditional I’m using doesn’t work
http://linux.linamariagiraldo.com/homework.html
<html>
<head>
<title>PHP homework</title>
</head>
<body>
<form action=”getform.php” type=”get”>
Color:
<select name=”color”>
<option value=”Red”>Red</option>
<option value=”Green”>Green</option>
<option value=”Blue”>Blue</option>
<br>
Shape:
<select name=”shape”>
<option value=”Square”>Square</option>
<option value=”Circle”>Circle</option>
</select>
<br>
Size:
<select name=”size”>
<option value=”Small”>Small</option>
<option value=”Large”>Large</option>
</select>
<br>
<input type=”submit” value=”Submit Me”>
</form>
</body>
</html>
———————
<html>
<head>
<title>Homework output</title>
</head>
<body>
<?
// Get the stuff entered into a form
$shape = $_GET[“shape”];
$color = $_GET[“color”];
//$size = $_GET[“size”];
// Based on what was selected in the form, pick an output
if ($shape == “square”) {
if ($size == “large”) {
echo “draw large square of $COLOR”;
} else {
echo “draw small square of $color”;
}
} else {
if ($size == “large”) {
echo “draw large circle”;
} else {
echo “draw small circle of $color”;
}
}
?>
</body>
</html>
Leave a Reply
You must be logged in to post a comment.