jeudi 26 novembre 2020

Unable to echo variable in value (HTML tag), help its my assignment

... So what im trying to do is, to get the output as Discount price & Total saved, i have written all the code but im not getting the out put, kindly somebody help. I don't understand why its happening.

PHP code is:

<?php 

if (isset($_GET['submit']))     {
    
    $price = $_GET["price"];
    $percent = $_GET["percent"];
    $discount = $price-($price*$percent/100);
    $saved = $price-$discount;
}
?>

I want to show the output in simple HTML tag value, but its not working.

<table align="center">
<tr>
<td>Discounted Price: </td>
<td><input type="text" name="discount" value='<?php echo $discount; ?>'></td>
</tr>
<tr>
<td>Total Saved: </td>
<td><input type="text" name="totalsaved" value='<?php echo $saved; ?>'></td>
</tr>
</table>



Aucun commentaire:

Enregistrer un commentaire