*/ $info = ""; if (file_exists($filename)) { $info = file_get_contents($filename); } $info = $info . $_POST["name"] . ";" . $_POST["number"] . ";" . $_POST["fruits"] . ";" . $_POST["quantity"] . "\n"; file_put_contents($filename, $info); ?> <!-- Ex 3: list the number of fruit sold in a file "customers.txt". Create unordered list to show the number of fruit sold --> This is the sold friuts count list: <br/> <ul> <?php $fruitcounts = soldFruitCount($filename); foreach ($fruitcounts as $key => $value) { ?> <li><?php echo $key . " - " . $value; ?> </li> <?php } ?> </ul> <?php } ?> <?php
(<?php echo $_POST['card']; ?> )</li> </ul> <!-- Ex 3 : --> <p>This is the sold fruits count list:</p> <?php /* Ex 3: * Save the submitted data to the file 'customers.txt' in the format of : "name;membershipnumber;fruit;number". * For example, "Scott Lee;20110115238;apple;3" */ $filename = "customers.txt"; soldFruitCount($filename); ?> <!-- Ex 3: list the number of fruit sold in a file "customers.txt". Create unordered list to show the number of fruit sold --> <ul> <?php #$fruitcounts = soldFruitCount($filename); #foreach() { ?> <!-- <li></li> --> <?php #} ?> </ul>