session_start();
//输入UTF-8文档类型
header('Content-Type: text/html; charset=utf-8');
//包含网站配置文件和通用的函数文件
include_once 'config.inc.php';
include_once 'common.function.php';
//如果包含了提交的数据
if (isset($_POST['ipt_jrating'])) {
    $record = array('rating_title' => $_POST['ipt_title'], 'rating_value' => $_POST['ipt_jrating'], 'rating_content' => $_POST['ipt_content']);
    $id = $db->insert('rating', $record);
    //调用insert方法进行更新
    if ($id) {
        echo "<script>alert('评分成功!')\n\t\twindow.location='bookdetail.php';</script>";
    }
}
$rating = getAvgRating();
//获取评分平均值
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="bookstyle.css">
<!--在这里包含jRating要使用的 -->
<!-- CSS文件 -->
<link rel="stylesheet" type="text/css" href="jquery/jRating.jquery.css" media="screen" />
<!-- jQuery文件 -->
<script type="text/javascript" src="jquery/jquery.js"></script>
<!--jRating插件文件-->
<script type="text/javascript" src="jquery/jRating.jquery.js"></script>
Пример #2
0
    print "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan='4'>\n\t\t\t\t\t\t\t<b>Participants not in Roster</b>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>";
}
$logged_participants = array();
while ($a = db_fetch_assoc($r)) {
    $userid = $a['user_id'];
    $e = $a['user_id'];
    /******************************************************************************
     * if listing participants and site has roster, 
     * include here only non-roster participants (roster participants listed above)
     * for each participant get # of posts and avg. rating
     ******************************************************************************/
    if (!in_array($userid, $logged_students_id) && $curraction == 'list') {
        $userid = $a[user_id];
        $logged_participants[] = $a[user_uname];
        $postcount = getNumPosts($userid);
        $avg_rating = getAvgRating($userid);
        //								if (!$_SESSION[editors]) {
        //									$checkstatus = " checked='checked'";
        //								} else if (in_array($e,$_SESSION[editors])) {
        //									$checkstatus = " checked='checked'";
        //								} else {
        //									$checkstatus = "";
        //								}
        print "\n\t\t\t\t\t<tr>";
        print "\n\t\t\t\t\t\t<td class='td{$color}' align='center'>\n\t\t\t\t\t\t\t<input type='checkbox' name='editors[]' value='{$e}' " . $checkstatus . " />\n\t\t\t\t\t\t</td>";
        print "\n\t\t\t\t\t\t<td class='td{$color}'>\n\t\t\t\t\t\t\t<a href='{$PHP_SELF}?{$sid}&amp;action=review&amp;userid=" . $a['user_id'] . "&amp;userfname=" . urlencode($a['user_fname']) . "&amp;" . htmlspecialchars($getvariables) . "'>" . $a['user_fname'] . "</a>\n\t\t\t\t\t\t</td>";
        print "\n\t\t\t\t\t\t<td class='td{$color}'>" . $a['user_email'] . "</td>";
        print "\n\t\t\t\t\t\t<td class='td{$color}'>" . $postcount . "</td>";
        print "\n\t\t\t\t\t\t<td class='td{$color}'>" . $avg_rating . "</td>";
        print "\n\t\t\t\t\t</tr>";
    }