GarryOne Posted October 13, 2011 Report Posted October 13, 2011 Preview: Demo: http://garryone.trei.ro/tests/voting.phpSource:<?phpfunction get_rating($number) { if(is_numeric($number)) { if($number <= 10 ) { for($i=1;$i<=$number;$i++) { echo '<img src="http://i.imgur.com/SdT8y.png" width="20px"/>'; } if(strpos($number,".") && substr($number,2,1) != 0) { if(substr($number,2,1) >2 && substr($number,2,1) <= 7) { echo '<img src="http://i.imgur.com/kl5R2.png" height="19px" />'; } if(substr($number,2,1) > 7) { echo '<img src="http://i.imgur.com/SdT8y.png" width="20px"/>'; } } } if($number > 10) { echo 'Value must be up to 10.'; } } if(!is_numeric($number)) { echo 'Value must be numeric.'; } }if(isset($_POST['submit'])) { echo get_rating($_POST['text']);}?><form action="" method="post"><input type="text" name="text" /><input type="submit" name="submit" /></form> Quote
soimuletzu1 Posted October 22, 2011 Report Posted October 22, 2011 Daca adaugi un numar cu - in fata nu iti da nici o eroare ... asta am sesizat, nu stiu daca conteaza sau nu ... oricum ii simplu si eficient. Quote
tur334vl Posted October 22, 2011 Report Posted October 22, 2011 mersi foarte practic chiar cautam asa ceva . ca am mai cumparat de pe net un script de genu il am instalat si acuma nu imi mai citeste loginul Quote