zdravim Vas. mam spraveny formular na vypocet cien
Kód:
http://web.atec.sk/po_anglicky/home.php
(umiestneny vpravo)
vo firefoxe funguje ako ma, teda pekne vypocita cenu.
ale v internet exploreri mi to vobec nefunguje, ked dam vypocitat, tak mi nic nevypocita, ako je to mozne ?
tu je cely formular html :Kód:
<div id="formular"
<form action='' method='post' style="width: 645px">
Number of words<sup>*</sup> in original text: <span lang="en-us">
<br />
</span> <input name='count' value='<?php echo $_POST['count']?$_POST['count']:""; ?>'><br/>
Language of origin text:<br />
<select name='original'><br/>
<option value='en' <?php echo $_POST['original']=='en'?"selected":""; ?>>English</option>
<option value='sk' <?php echo $_POST['original']=='sk'?"selected":""; ?>>Slovak</option>
</select><br/>
Required language:<br />
<select name='required'><br/>
<option value='en' <?php echo $_POST['required']=='en'?"selected":""; ?>>English</option>
<option value='sk' <?php echo $_POST['required']=='sk'?"selected":""; ?>>Slovak</option>
</select><br/>
Type of text:<br />
<select name='type'>
<option value='general' <?php echo $_POST['type']=='general'?"selected":""; ?>>General</option>
<option value='expert' <?php echo $_POST['type']=='expert'?"selected":""; ?>>Expert</option>
</select><br />
<br />
<br />
<button type='submit'>Calculate</button> <br/>
<br />
<br />
*You can easily find out the number of words of your text in the MS WORD text editor using the function <b>Tools > Word Count > </b>
<?php
if($price) echo "<p class='vypocet'>Your price of translation is ".number_format($price, 2, ',', ' ')."€</p>"; // number format 2=počet desetinných, čárka = desetinný oddělovač, a mezera oddělovač tisíců
?>
</form>
</div>
a tu je php :Kód:
<?php
if($_POST){
if(!preg_match("~^\d+$~",$_POST['count'])){
echo "<p style='color: red;'>Počet slov není číslo</p>"; // pokud zadá blbost do počtu slov
}
else{
if($_POST['original'] == 'en' and $_POST['required'] == 'sk'){ // z english do slovak
switch($_POST['type']){
case "general":
$price = $_POST['count'] * 0.04; //general
break;
case "expert":
$price = $_POST['count'] * 0.044; //expert
break;
}
}
elseif($_POST['original'] == 'sk' and $_POST['required'] == 'en'){ // z slovak do english
switch($_POST['type']){
case "general":
$price = $_POST['count'] * 0.048; //general
break;
case "expert":
$price = $_POST['count'] * 0.052; //expert
break;
}
}
else {
echo "<p style='color: red;'>Špatně jste vybrali jazyky</p>"; // pokud vybere z EN do EN nebo z SK do SK
}
}
}
?>