J'essaie de faire une calculatrice qui prendra les entrées des utilisateurs et d'estimer pour eux combien d'argent ils vont économiser s'ils utilisent différents services VoIP différents.aide de base php
Je l'ai établi comme ceci:
<form method="get" action="voip_calculator.php">
How much is your monthly phone bill?
<input name="monthlybill" type="text" value="$" size="8">
<p><input type="submit" name="Submit" value="Submit">
</p>
</form>
Sur voipcalculator.php, la page que je tiens, je veux appeler « monthlybill » mais je ne peux pas comprendre comment le faire. Je ne peux pas non plus comprendre comment faire la soustraction sur les nombres dans les lignes.
Cela peut être très simple pour vous mais c'est très frustrant pour moi et je demande humblement un peu d'aide. Je vous remercie!
Voici les choses pertinentes de voip_calculator, vous pouvez également cliquer sur l'URL et de soumettre un certain nombre pour le voir en (in) action. J'ai essayé plusieurs fois de l'appeler sans succès:
<table width="100%;" border="0" cellspacing="0" cellpadding="0"class="credit_table2" >
<tr class="credit_table2_brd">
<td class="credit_table2_brd_lbl" width="100px;">Services:</td>
<td class="credit_table2_brd_lbl" width="120px;">Our Ratings:</td>
<td class="credit_table2_brd_lbl" width="155px;">Your Annual Savings:</td>
</tr>
Your monthly bill was <?php echo 'monthlybill' ?>
<?php echo "$monthlybill"; ?>
<?php echo "monthlybill"; ?>
<?php echo '$monthlybill'; ?>
<?php echo 'monthlybill'; ?>
<?php
$monthybill="monthlybill";
$re=1;
$offer ='offer'.$re.'name';
$offername= ${$offer};
while($offername!="") {
$offerlo ='offer'.$re.'logo';
$offerlogo=${$offerlo};
$offerli ='offer'.$re.'link';
$offerlink=${$offerli};
$offeran ='offer'.$re.'anchor';
$offeranchor=${$offeran};
$offerst ='offer'.$re.'star1';
$offerstar=${$offerst};
$offerbot='offer'.$re.'bottomline';
$offerbottomline=${$offerbot};
$offerca ='offer'.$re.'calcsavings';
$offercalcsavings=${$offerca};
echo '<tr >
<td >
<a href="'.$offerlink.'" target="blank">
<img src="http://www.nextadvisor.com'.$offerlogo.'" alt="'.$offername.'" />
</a>
</td>
<td >
<span class="rating_text">Rating:</span>
<span class="star_rating1">
<img src="IMAGE'.$offerstar.'" alt="" />
</span>
<br />
<div style="margin-top:5px; color:#0000FF;">
<a href="'.$offerlink.'" target="blank">Go to Site</a>
<span style="margin:0px 7px 0px 7px;">|</span>
<a href="'.$offeranchor.'">Review</a>
</div>
</td>
<td >'.$offercalcsavings.'</td>
</tr>';
$re=$re+1;
$offer ='offer'.$re.'name';
$offername= ${$offer};
}
?>
offercal (1,2,3,4,5,6,7) appelle l'épargne dans un fichier appelé values.php où ils sont défini comme ceci:
$offer1calcsavings="24.99";
$offer2calcsavings="20.00";
$offer3calcsavings="21.95";
$offer4calcsavings="23.95";
$offer5calcsavings="19.95";
$offer6calcsavings="23.97";
$offer7calcsavings="24.99";
Je tente aussi de soustraire une variable d'un autre et afficher le résultat. Je veux que $ facture mensuelle soustraite de $ 1 (2,3,4,5,6,7) calcsavings et ensuite affiché dans ce tableau. Devrait demander cela comme une question distincte? –
@pg: oui. poster le lien ici une fois que vous avez terminé. – nickf
Si vous crachez une entrée à l'utilisateur vous devriez soit appeler htmlspecialchars() ou faire une sorte de validation, sinon vous aurez un problème XSS –