- Code: Select all
$myName = $_GET["myName"];
but it will not work. please advise. thank you.
- Code: Select all
<!--CISS225 Warren Tolentino-->
<!--Web Design PHP and MySQL-->
<?php
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Assignment 02: Bad Code</title>
<style>
body {background-color:lightsalmon;
color:#333;
font-weight:bold;
font-family:calibri;}
h1,h2,h3,h4 {color:maroon;}
</style>
</head>
<body>
<form method="get" action="form.php">
<p><label>Name: <input type="text" name="myName"</label></p>
<p>what is your favorite ice cream:
<select name="dlIceCream">
<option value="01">Mango</option>
<option value="02">Strawberry</option>
<option value="03">Chocolate</option>
<option value="04">Vanilla</option>
<option value="05">Cherry</option>
<option value="06">Blueberry</option>
<option value="07">Cookies n Cream</option>
<option value="08">Peach</option>
<option value="09">Banana</option>
<option value="10">Avocado</option>
</select>
</p>
<fieldset><legend>what is your favorite season</legend>
<input id="rbSummer" type="radio" required />
<label for="rbSummer">Summer</label>
<input id="rbFall" type="radio" />
<label for="RBFall">Fall</label>
<input id="rbSpring" type="radio" />
<label for="rbSpring">Spring</label>
</fieldset>
<br>
<fieldset><legend>what is your favorite hobby</legend>
<input type="checkbox" name="cb01" value="computer"><label>Computer</label>
<input type="checkbox" name="cb02" value="sport"><label>Sports</label>
<input id="rbWinter" type="radio" />
<label for="rbWinter">Winter</label>
<input type="checkbox" name="cb03" value="garden"><label>Gardening</label><br>
<input type="checkbox" name="cb04" value="cook"><label>Cooking</label>
<input type="checkbox" name="cb05" value="read"><label>Reading</label>
<input type="checkbox" name="cb06" value="paint"><label>Painting</label><br>
</fieldset>
<p>
<!-- <input type="button" value="submit" /> -->
<!-- <input type="reset" value="reset" /> -->
</p>
</form>
<!--<a href="index.php">Back to Index</a> -->
<?php
if (!isset($_GET["submit"]))
{
?>
<form>
<input type="submit" value="submit" name="submit" />
<input type="reset" value="reset" />
</form>
<?php
}
else
{
?>
$myName = $_GET["myName"];
<h2>Form was submitted</h2>
<?php
}
?>
</body>
</html>