1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| <form action="simulation.php" method="post">
<div> <label>Cours</label><input id="Cours" name="Cours" type="text" placeholder="Ex:200" autofocus required></div>
<div> <?php
$base = mysql_connect('localhost','root','');
mysql_select_db('cbt',$base);
echo '<label for="Produit">Produit</label>'."\n";
echo '<select name="produit">'."\n";
echo '<option value="-1">Type de produit</option>'."\n";
$result = mysql_query("SELECT id,produit FROM optionsble ORDER by id" );
while($data = mysql_fetch_array($result))
{
echo '<option >'.$data['produit'] ;
echo '</option>'."\n";
}
echo '</select>'."\n";
?>
</div>
<div> <label>Prime Call/Put</label><input name="Prime" id="Prime" type="text" placeholder="Ex:12" autofocus required></div>
<div> <label>Nb lots</label><input id="Lots" name="Lots" type="text" placeholder="Ex:2" autofocus required></div>
<div> <label>Objectif du Cours</label><input name="objCours" id="objCours" type="text" placeholder="Ex:231" autofocus required></div>
<div><input type="submit" name="valider" value="Simulation de gain"> <input type="reset" name="Submit" value="Reset" /></div>
<?php
if(isset($_POST['valider'])){
$Cours = $_POST['Cours'] ;
$Prime = $_POST['Prime'] ;
$Lots = $_POST['Lots'] ;
$objCours = $_POST['objCours'] ;
$resultat = (($objCours - $Cours) * $Prime) * $Lots;
echo '<p class="message-box">Votre gain est de ' . $resultat . ' euros</p>';
}
?> |
Partager