http500 error occurred after PHP submitted form

Source: Internet
Author: User
Tags php print
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
");
?>








































Price Cost
Order Information
Product UnitQuantity Ordered Item
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];
//}
?>








Administrator:
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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.