I am twistin’ my brain tryin’ to figure out what I’m doing wrong… I know I am probably over looking something. If anyone can give me a second look and see if you see something I don’t see:
<HTML>
<head>
<title>Zellers Carpeting Cost Estimate</title>
</head>
<?php
$bValid = true;
$strMessage = “There is a problem with the following items: “;
//set vars if there is anything in the query string
if ((count($_GET) >0)) {
$width = $_GET[‘width’];
$length = $_GET[‘length’];
$carpet = $_GET[‘carpet’];
$padding = $_GET[‘padding’];
}
if ((!is_numeric($width)) || (!is_numeric($length))) {
$bValid = false;
$strMessage = “$strMessage Width and length must be a valid numbers…”;
}
if ($carpet == “”) {
$bValid = false;
$strMessage = “$strMessage Carpet must be selected…”;
}
if ($padding == “”) {
$bValid = false;
$strMessage = “$strMessage Padding must be selected…”;
}
if (isset($_GET[‘install’]) == false) {
$bValid = false;
$strMessage = “$strMessage You must choose Installation or not”;
$install = “”;
}
else {
$install = $_GET[‘install’];
}
}
// if validation fails, set the vars to empty strings, display error message(s)
else {
$width = “”;
$length = “”;
$carpet = “”;
$padding = “”;
$install = “”;
}
if ((count($_GET)==0)||($bValid ==false)){
if ($bValid==false){
print (“<div class=’errorMsg’>$strMessage</div>”);
}
}
?>
<body>
<div id=”banner”>
<h1>Zellers Carpeting</h1>
<h2>Cost Estimate</h2>
</div>
<div class=”instructions”>Enter all the relevant parameters and click submit for an estimate
of the cost of carpeting your room</div>
<img src = <?php // select image source, depending on the carpet selection
switch ($carpet) {
case “B”:
print ‘budget.jpg’;
break;
case “S”:
print ‘standard.jpg’;
break;
case “P”:
print ‘premium.jpg’;
break;
case “”:
print ‘logo.jpg’;
}
?> />
<div id=”userinput”>
<form method=”get” name=”frmInput” action=”CarpetForm.php”>
<table>
<tr>
<td><strong>Room Dimensions (in ft):</strong></td>
<td><input type=text name=width value=”<?php print (“$width”) ?>”> x <input type=text name=length value=”<?php print(“$length”) ?>”></td>
</tr>
<tr>
<td ><strong>Type of Carpet:</strong></td>
<td>
<select name=carpet value = “<?php print (“$carpet”) ?>”>
<option value=””>Choose Carpet Type</option>
<option value=”B”>Budget</option>
<option value=”S”>Standard</option>
<option value=”P”>Premium</option>
</select>
</td>
</tr>
<tr>
<td ><strong>Type of Padding:</strong></td>
<td>
<select name=padding value=”<?php print (“$padding”) ?>”>
<option value=””>Choose Padding</option>
<option value=”S”>Standard</option>
<option value=”P”>Premium</option>
</select>
</td>
</tr>
<tr>
<td><strong>Installation Required:</strong></td>
<td>Yes<input type=radio name=install value=y> No<input type=radio name=install value=n></td>
</tr>
<tr>
<td align=center colspan=2><input type=”button” value=”Submit”></td>
</tr>
</table>
</form>
</div>
</body></HTML>