Ето тук една анкета (porostorm я беше дал майче).Ето form.phpАз съм направил някой добавки,да показва процентите.
<SCRIPT TYPE="text/javascript">
</SCRIPT>
<?
/*
Begin options
*/
$poll_file = "poll_script.php"; // Change this to the name of the other PHP file downloaded
$poll_cookie_name = "poll_cookie"; // This is the cookie name that is set so that the "Vote" button is hidden on the form - you should change this name each time you change the poll so that previous voters may vote again in the new poll
$poll_results_file = "results.txt"; // Change this to the file that holds the poll results
$poll_redirect_page = "form.php"; // Change this to the page you want to redirect the visitor to after he/she votes
$poll_cookie_expires = 86400; // Change this to the amount of time, in seconds, the cookie stays in the visitor's browser so that he/she may vote again after the cookie expires. 604800 seconds is equal to one week
$choices_file = fopen($poll_results_file, "a+");
$choices = fread($choices_file, 1024);
$choices = explode("\t", $choices);
fclose($choices_file);
?>
<center>
<table>
<td>
<td>
<form action="<?=$poll_file?>" method="post" onSubmit="form(this, 'join')" style="margin: 0px">
<b>Как ви се струва сайта?</b><br>
<?=$message?><br />
<input style="border:0px" id="chos" name="choice" type="radio" value="0" /> Да,много! (<strong><?=$choices[0]/($choices[0]+$choices[1]+$choices[2]+$choices[3]+$choices[4])*100?>%</strong>)<br />
<input style="border:0px" id="chooos" name="choice" type="radio" value="1" /> Добре е! (<strong><?=$choices[1]/($choices[0]+$choices[1]+$choices[2]+$choices[3]+$choices[4])*100?>%</strong>)<br />
<input style="border:0px" id="choos" name="choice" type="radio" value="2" /> Горе долу! (<strong><?=$choices[2]/($choices[0]+$choices[1]+$choices[2]+$choices[3]+$choices[4]+$choices[5])*100?>%</strong>)<br />
<input style="border:0px" id="choose" name="choice" type="radio" value="3" /> Не ми харесва! (<strong><?=$choices[3]/($choices[0]+$choices[1]+$choices[2]+$choices[3]+$choices[4])*100?>%</strong>)<br />
<input style="border:0px" id="choose1" name="choice" type="radio" value="4" /> Не! (<strong><?=$choices[4]/($choices[0]+$choices[1]+$choices[2]+$choices[3]+$choices[4])*100?>%</strong>)<br /><br>
<input id="cooki" name="cookie_name" type="hidden" value="<?=$poll_cookie_name?>" />
<input id="results" name="results_file" type="hidden" value="<?=$poll_results_file?>" />
<input id="redirect" name="redirect_page" type="hidden" value="<?=$poll_redirect_page?>" />
<input id="cook" name="cookie_expires" type="hidden" value="<?=$poll_cookie_expires?>" />
</td>
</tr>
</table>
Общо <strong><?=$choices[0]+$choices[1]+$choices[2]+$choices[3]+$choices[4]+$choices[5]+$choices[6]+$choices[7]+$choices[8]+$choices[9]?></strong> <em>гласа</em><br /></center>
<? if(!isset($_COOKIE["$poll_cookie_name"])) { ?>
<center>
<input onmouseover="style.color='#FF6600'" onmouseout="color='black'" name="submit" style="margin: 0 0 10px 0; padding: 0 15px 0 15px" type="submit" value="Гласувай!" /></center>
<? } else { ?>
<? } ?>
</form>
Ето това = след <? в тоя израз <?=$choices[1]/($choices[0]+$choices[1]+$choices[2]+$choices[3]+$choices[4])*100?>
не ми е ясен. Идеята ми е да направя процентите да ги показва като цели числа,вместо 66,232323232 % да показва 66%.Помагайте :?:
<SCRIPT TYPE="text/javascript">
</SCRIPT>
<?
/*
Begin options
*/
$poll_file = "poll_script.php"; // Change this to the name of the other PHP file downloaded
$poll_cookie_name = "poll_cookie"; // This is the cookie name that is set so that the "Vote" button is hidden on the form - you should change this name each time you change the poll so that previous voters may vote again in the new poll
$poll_results_file = "results.txt"; // Change this to the file that holds the poll results
$poll_redirect_page = "form.php"; // Change this to the page you want to redirect the visitor to after he/she votes
$poll_cookie_expires = 86400; // Change this to the amount of time, in seconds, the cookie stays in the visitor's browser so that he/she may vote again after the cookie expires. 604800 seconds is equal to one week
$choices_file = fopen($poll_results_file, "a+");
$choices = fread($choices_file, 1024);
$choices = explode("\t", $choices);
fclose($choices_file);
?>
<center>
<table>
<td>
<td>
<form action="<?=$poll_file?>" method="post" onSubmit="form(this, 'join')" style="margin: 0px">
<b>Как ви се струва сайта?</b><br>
<?=$message?><br />
<input style="border:0px" id="chos" name="choice" type="radio" value="0" /> Да,много! (<strong><?=$choices[0]/($choices[0]+$choices[1]+$choices[2]+$choices[3]+$choices[4])*100?>%</strong>)<br />
<input style="border:0px" id="chooos" name="choice" type="radio" value="1" /> Добре е! (<strong><?=$choices[1]/($choices[0]+$choices[1]+$choices[2]+$choices[3]+$choices[4])*100?>%</strong>)<br />
<input style="border:0px" id="choos" name="choice" type="radio" value="2" /> Горе долу! (<strong><?=$choices[2]/($choices[0]+$choices[1]+$choices[2]+$choices[3]+$choices[4]+$choices[5])*100?>%</strong>)<br />
<input style="border:0px" id="choose" name="choice" type="radio" value="3" /> Не ми харесва! (<strong><?=$choices[3]/($choices[0]+$choices[1]+$choices[2]+$choices[3]+$choices[4])*100?>%</strong>)<br />
<input style="border:0px" id="choose1" name="choice" type="radio" value="4" /> Не! (<strong><?=$choices[4]/($choices[0]+$choices[1]+$choices[2]+$choices[3]+$choices[4])*100?>%</strong>)<br /><br>
<input id="cooki" name="cookie_name" type="hidden" value="<?=$poll_cookie_name?>" />
<input id="results" name="results_file" type="hidden" value="<?=$poll_results_file?>" />
<input id="redirect" name="redirect_page" type="hidden" value="<?=$poll_redirect_page?>" />
<input id="cook" name="cookie_expires" type="hidden" value="<?=$poll_cookie_expires?>" />
</td>
</tr>
</table>
Общо <strong><?=$choices[0]+$choices[1]+$choices[2]+$choices[3]+$choices[4]+$choices[5]+$choices[6]+$choices[7]+$choices[8]+$choices[9]?></strong> <em>гласа</em><br /></center>
<? if(!isset($_COOKIE["$poll_cookie_name"])) { ?>
<center>
<input onmouseover="style.color='#FF6600'" onmouseout="color='black'" name="submit" style="margin: 0 0 10px 0; padding: 0 15px 0 15px" type="submit" value="Гласувай!" /></center>
<? } else { ?>
<? } ?>
</form>
Ето това = след <? в тоя израз <?=$choices[1]/($choices[0]+$choices[1]+$choices[2]+$choices[3]+$choices[4])*100?>
не ми е ясен. Идеята ми е да направя процентите да ги показва като цели числа,вместо 66,232323232 % да показва 66%.Помагайте :?: