做的简单练习题...希望高手能指点我的错误,让我明白我的错误.非常感谢!!!2 a)Define a function called toast that takes minutes as a parameter.the function prints "down".(定义一个function叫做toast用minutes 作为参数,prints "done"这个词!)
回答:function toast($minutes)
{ echo "done"; }
b)call the function toast use 5 as the parameter.(用5作为参数呼叫function toast) 回答:function toast($minutes)
{ echo "done"; }
toast(5); c)assuming that the form has already being created as shown above.You are required to create a PHP program that will calculate the total cost based on the price list given below and display the amount that the user needs to pay(based on the user input).(Note:You MUST use array to store the values given in the table below)
假设上面的表格已经建好,你被要求依据价格表建一个计算总花费的php程序并且输出期间用户需要付的钱(根据用户输入)。(注意:你必须用啊仍然用array存储下面表格里给出的值)
回答:function toast($minutes)
{ echo "done"; }
b)call the function toast use 5 as the parameter.(用5作为参数呼叫function toast) 回答:function toast($minutes)
{ echo "done"; }
toast(5); c)assuming that the form has already being created as shown above.You are required to create a PHP program that will calculate the total cost based on the price list given below and display the amount that the user needs to pay(based on the user input).(Note:You MUST use array to store the values given in the table below)
假设上面的表格已经建好,你被要求依据价格表建一个计算总花费的php程序并且输出期间用户需要付的钱(根据用户输入)。(注意:你必须用啊仍然用array存储下面表格里给出的值)
第一个是 Flower:<填入>
第二个是 数量: <填入>
第二章图:
是个列表 Rose 2.5(yuan)
Daisy 1.25
Orchid 1.5
(第二个是存到数组里的要求)
还有对于$_POST 和$_GET具体应用上有什么区别?我知道他们一个是存一个是取,但我想找个明显的例子区分下有谁能给个? 谢谢...
<?php
$number;
$input_flower=$_POST["flower_name"];
$input_number=$_POST["number"];
global $total_money;
$arr= array("Rose"=>2.5,"Daisy"=>1.25,"Orchid"=>1.5);
switch($input_flower){
case "Rose":
return $tutal_money=$arr["Rose"]*$input_number;
break;
case "Daisy":
return $tutal_money=$arr["Daisy"]*$input_number;
break;
case "Orchid":
return $tutal_money+$arr["Orchid"]*$input_number;
break;
default:
echo "please choose flower name : <Rose> <Daisy> and <Orchid>";
}
echo "the total money is :".$tutal_money;
?>