- create two php scripts named \"list.php\" and \"detail.php\". - The \"list.php
ID: 3906559 • Letter: #
Question
- create two php scripts named "list.php" and "detail.php".
- The "list.php" will create a list of fruit names. Each item on the list is a link. When clicking on a link, the "detail.php" will be excuted which will generate the name and price of that fruit.
- A sample is below:
? ? è 127.0.0·1/395/2%20Variables/exerise/a.php Fruit Information Our store has the following fruits for sale. Click each link for detail Apple .Organe Peach . Banana Pear Mango . Grape ? ? D 127.0.0 . 1/395/2%20Variables/exerise/b.php?name =%20pear&price-96202.5; Fruit Information What you have selected is: pear The price of the pear is: 2.5Explanation / Answer
list.php
<html>
<head>
<title>List Fruits</title>
<style type = "text/css">
body{
color: #037EE2;
}
</style>
</head>
<body>
<h2>Fruit Information</h2>
<h3>Our Store has the following fruits for sale. Click each link for detail.</h3>
<ul>
<li><a href="detail.php?name=Apple&price=4.5">Apple</a></li>
<li><a href="detail.php?name=Orange&price=6.5">Orange</a></li>
<li><a href="detail.php?name=Peach&price=2.5">Peach</a></li>
<li><a href="detail.php?name=Banana&price=8.5">Banana</a></li>
<li><a href="detail.php?name=Pear&price=6.5">Pear</a></li>
<li><a href="detail.php?name=Mango&price=6.5">Mango</a></li>
<li><a href="detail.php?name=Grape&price=4.5">Grape</a></li>
</ul>
</body>
</html>
detail.php
<html>
<head>
<title>Fruit Detail</title>
<style type = "text/css">
body{
color: #037EE2;
}
</style>
</head>
<body>
<?php
$name = $_REQUEST["name"];
$price = $_REQUEST["price"];
echo "What you have selected is: ".$name;
echo " The price of the ".$name." is: ".$price;
?>
</body>
</html>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.