Novice, just contact PHP, trouble you Big God
HTML section
<title>Popcorn Sales</title>
PHP Program
<title>Process the popcorn.html form</title>
$unpop =$_post["UnPop"];
$caramel =$_post["Caramel"];
$caramelnut =$_post["Caramelnut"];
$toffeynut =$_post["Toffeynut"];
$name =$_post["name"];
$street =$_post["Street"];
$city =$_post["City"];
$payment =$_post["Payment"];
if ($unpop = = "") $unpop = 0;
if ($caramel = = "") $caramel = 0;
if ($caramelnut = = "") $caramelnut = 0;
if ($toffeynut = = "") $toffeynut = 0;
$unpop _cost=3.0* $unpop;
$caramel _cost=3.5* $caramel;
$caramelnut _cost=4.5* $caramelnut;
$toffeynut _cost=5.0* $toffeynut;
$total _price= $unpop _cost+ $caramel _cost+ $caramelnut _cost+ $toffeynut _cost;
$total _items= $unpop + $caramel + $caramelnut + $toffeynut;
?>
Customer:
Print ("$name
$street
$city
");
?>
Order Information
Product |
Unit | Price
Quantity Ordered |
Item | Cost
Unpopped Popcorn |
$3:00 |
|
|
Caramel Popcorn |
$3:50 |
|
|
Caramel Nut Popcorn |
$4:50 |
|
|
Toffey Nut Popcorn |
$5:00 |
|
|
Unpopped Popcorn |
$3:00 |
|
|
Print ("You odered $total _items popcorn Items
");
printf ("Your total bill is:$%5.2f
", $total _price);
Print ("Your chosen method of payment is: $payment
");
?>
Reply to discussion (solution)
500 is an internal error ... Cause multiple facets. Let's change Apache.
This code is wrong
What is this stuff?
$unpop =$_post["UnPop"];
$caramel =$_post["Caramel"];
$caramelnut =$_post["Caramelnut"];
$toffeynut =$_post["Toffeynut"];
$name =$_post["name"];
$street =$_post["Street"];
$city =$_post["City"];
$payment =$_post["Payment"];
Don't you see this code will report undefined variable warnings?
If the error display is not turned on, it is 500 wrong.
$_post should write $_post
Well, the post should be capitalized.
First floor: Apache no problem, just wrote another form of the code, can run normally.
As for the second and third floor: You said this code was originally debugging, without success, it was written off. But it hasn't been removed.
Post, uppercase, or error
Run directly in the browser of course not, you have to submit
PHP.ini in the Display_errors=on, then restart the server and then run to see.
After the change, Apache, browser restart or the like. Depressed... My Apache version is relatively low, is not the version of the problem. But this code is going to work.
PhP2
if ($Submit = = "Commit") {
$username =$_post[username];
$password =$_post[password];
//}
?>
Just try it again. I don't know what the reason is, I might as well change PHP. In the after good, display_errors=on what is the use? is the error able to be displayed on top of the browser?
Right! Errors can be displayed on the browser