PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Akhilesh   Rating Star   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: this is example
Class: Rating Star
Display star images according to rating values
Author: By
Last change:
Date: 17 years ago
Size: 1,825 bytes
 

Contents

Class file image Download
<?
/*******************************************************************************************************
* This is example for how to use the class just need to give the numeric value of the rateing from
* 1,1.5,2,2.5 to 5.
********************************************************************************************************/


 
include_once"star_class.php"?>
<script language="javascript1.2">
function reloadpage(val)
{
window.location.href="example.php?rate="+val;
}
</script>
<?
$query_str
= $_SERVER['QUERY_STRING'] ;
/*--------------------if rate alreay exists in query string please remove them ---------------------------*/
$str_pos=strpos($query_str,'rate');
if(
$str_pos>0)
$query_str=substr($query_str,0,$str_pos);
/*---------------------------------------------------------------------------------------------------------*/
?>
<form name="frm" action="" method="post">
<table width="100%%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="26%" align="right">&nbsp;Rate</td>
    <td width="3%">&nbsp;</td>
    <td width="46%"><select name="rate" onchange="reloadpage(this.value);">
    <option value="rate">rate</option>
    <option value="1">1</option>
    <option value="1.5">1.5</option>
    <option value="2">2</option>
    <option value="2.5">2.5</option>
    <option value="3">3</option>
    <option value="3.5">3.5</option>
    <option value="4">4</option>
    <option value="4.5">4.5</option>
    <option value="5">5</option>
    </select></td>
    <td width="25%">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><?
     $rate
= $_GET['rate'];
     if(
$rate!="")
     {
     global
$obj_star;
    
$obj_star = new star_class;
    echo
$obj_star->show_star($rate);
     }
   
?></td>
    <td>&nbsp;</td>
  </tr>
</table>
</form>