Can someone tell me what is wrong with my PHP?

lcedlightning

New member
Here is my code. When I submit my html form (the action is this php script), i am returned a blank page at the address (http://.../hw05.php)


<?xml version = "1.0" encoding ="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title> Process Lightbulb Purchase </title>
</head>

<body>
<?php error_reporting(E_ALL);

// get data
$fourLB = $_POST["fourLB"];
$fourLBLL = $_POST["fourLBLL"];
$eightLB = $_POST["eightLB"];
$eightLBLL = $_POST["eightLBLL"];
$name = $_POST["nameTextBox"];
$payment = $_POST["radioButton"];

// set to zero
if ($fourLB == "") $fourLB = 0;
if ($eightLB == "") $eightLB = 0;
if ($fourBLL == "") $fourLBLL = 0;
if ($eightLBLL == "") $eightLBLL = 0;

// compute cost
$fourLBCost = $fourLB * 2.95;
$eightLBCost = $eightLB * 4.29;
$fourLBLLCost = $fourLBLL * 3.95;
$eightLBLLCost = $eightLBLL * 7.49;
$subtotal = $fourLBCost + $fourLBLLCost + $eightLBCost + $eightLBLLCost;
$tax = $subtotal * .0625;
$totalPrice = $subtotal + $tax;
$totalItems = $fourLB + $fourLBLL + $eightLB + $eightLBLL;

// create table
?>

<h4> Customer: </h4>
<?php print ("Name: $name <br />"); ?>
<p /> <p />
<table border = "1px">
<caption> Order Information </caption>
<tr>
<th> Product </th>
<th> Unit Price </th>
<th> Quantity Ordered </th>
<th> Item Cost </th>
</tr>
<tr align = "center">
<td> Four 100W LB </td>
<td> $2.95 </td>
<td> <?php print ("$fourLB"); ?> </td>
<td> <?php printf("$ %4.2f", $fourLBCost); ?> </td>
</tr>
<tr align = "center">
<td> Eight 100W LB </td>
<td> $4.29 </td>
<td> <?php print ("$eightLB"); ?> </td>
<td> <?php printf("$ %4.2f", $eightLBCost); ?> </td>
</tr>
<tr align = "center">
<td> Four 100W LL LB </td>
<td> $3.95 </td>
<td> <?php print ("$fourLBLL"); ?> </td>
<td> <?php printf("$ %4.2f", $fourLBLLCost); ?> </td>
</tr>
<tr align = "center">
<td> Eight 100W LL LB </td>
<td> $7.49 </td>
<td> <?php print ("$eightLBLL"); ?> </td>
<td> <?php printf("$ %4.2f", $eightLBLLCost); ?> </td>
</tr>
</table>
<p /><p />

<?php
print "You ordered $totalItems lightbulbs <br />";
printf ("Your total bill is: $ %5.2f <br />", $totalPrice);
print "Your chosen method of payment is: $payment <br />";
?>
</body>
</html>


I figured that the error reporting would tell me what was wrong, but even after enabling this, I still receive a blank page. If there is any more information that I need to provide, please let me know.

Thanks for your help!
 
Back
Top