Professional Documents
Culture Documents
HTML Code: PHP Script To Read The List of Item Names and Corresponding Price and To Find The Cheapsest and Costliest Item
HTML Code: PHP Script To Read The List of Item Names and Corresponding Price and To Find The Cheapsest and Costliest Item
costliest item
HTML COde
<html>
<head>
</head>
<body>
<p>
</p>
<p>
Enter the coreesponding price of Items <br> ( seoerated with space )<br>
</p>
<p>
</p>
</form>
</body>
</html>
PHP script
<?php
$itemname=$_POST['items'];
$itemprice=$_POST['prices'];
if(empty($itemname)||empty($itemprice))
$itemsA=explode(" ",$itemname);
$priceA=explode(" ",$itemprice);
$item_count=count($itemsA);
$price_count=count($priceA);
if($item_count!=$price_count)
die("The number of items and the number of prices should match ");
for($i=0;$i<$item_count;$i++)
echo "</table>";
$maxp=max($priceA);
$minp=min($priceA);
for($i=0;$i<$item_count;$i++)
if($maxp==$priceA[$i])
?>