<?php $server='localhost'; $username='root'; $password='1234'; $db_name='customer'; mysql_connect($server, $username, $password) or die('เชื่อมต่อฐานข้อมูลผิดพลาด'); mysql_select_db($db_name); mysql_query("SET NAMES UTF8"); ?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <?php include 'connect.php'; $gatusers = mysql_query("SELECT * FROM cus") or die (mysql_error()); if(mysql_num_rows($gatusers)== 0){ echo "ไม่มีข้อมูล"; }else{ while ($user_info = mysql_fetch_array($gatusers,MYSQLI_ASSOC)){ $user_id = $user_info["id"]; $name=$user_info['name']; $score=$user_info['score']; echo "<pre>"; echo"ลำดับที่ : $user_id". "." ; echo"$name $score<br>"; echo"<pre>"; echo("<a href='vote.php?action=edit&user_id=".$user_id."'> [voteให้พขร.ท่านนี้]</a>"); } } ?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <?php require "connect.php"; if (isset($_POST["submit"]) ){ $score=$_POST["choice"]; if($score !=0){ mysql_query("UPDATE cus SET score = '$score'WHERE id = '$user_id'") or die (mysql_error()); echo "การลงคะแนน เรียบร้อยแล้ว"; }else{ echo "กรุณาใส่คะแนน"; } } ?> <?php if(isset($_GET["action"]) && isset ($_GET["user_id"]) ){ $action=$_GET["action"]; $user_id=$_GET["user_id"]; if (strcmp($action, "edit") == 0){ $gatusers= mysql_query("SELECT * FROM cus WHERE id = '$user_id' ")or die (mysql_error()); if (mysql_num_rows($gatusers)== 0){ echo 'ไม่มีข้อมูลในฐานข้อมูล'; }else{ $user_info = mysql_fetch_array($gatusers, MYSQL_ASSOC); $user_id= $user_info["id"]; $name= $user_info["name"]; $score= $user_info["score"]; } } } ?> <head> <title>แบบสำรวจความพึงพอใจที่มีต่อพนักงานขับรถ</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-874"> </head> <body bgcolor="#FFFFFF"> <form name="form1" method="post" action="vote.php"> <input type="radio" name="choice" value="4"> ดีมาก<br> <input type="radio" name="choice" value="3"> ดี<br> <input type="radio" name="choice" value="2"> พอใช้<br> <input type="radio" name="choice" value="1"> ต้องปรับปรุง <input type="submit" value="บันทึกข้อมูล" > <input type="reset" value="ยกเลิก"> </form> </body>
<?php require 'connect.php'; if (isset($_POST["submit"]) ){ $score=$_POST["choice"]; echo $score; if($score !=0){ mysql_query("UPDATE cus SET score= '$score'WHERE id = '$user_id'") or die (mysql_error()); echo "การลงคะแนน เรียบร้อยแล้ว"; }else{ echo "กรุณาใส่คะแนน"; } } ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง