値を mysql に保存するフィードバック フォーム (評価 1 ~ 5) があります。
今、データベースから現在の年/月のすべての評価を取得し、それらを合計し、平均計算を行う、実行する PHP コードを教えてください。次に、値をグラフとして表示します。
ありがとう。
これは私のフィードバック フォームの html です
<body>
<form id="form1" name="form1" method="post" action="process.php" style="border:1px #CCCCCC solid; width:720px; margin:0 auto; padding:10px;">
<table width="700" align="center" cellpadding="0" cellspacing="0" >
<tbody>
<tr><td valign="top"><strong>How would you evaluate the waiting before the procedures in our areas ?</strong>
<label>
<p>
<input type="radio" name="radio1" id="radio1" value="1" />
<input type="radio" name="radio1" id="radio1" value="2" />
<input type="radio" name="radio1" id="radio1" value="3" />
<input type="radio" name="radio1" id="radio1" value="4" />
<input type="radio" name="radio1" id="radio1" value="5" />
<br />
</p>
</label></td></tr><tr><td valign="top"><strong>How would you evaluate your consultation with the medical team prior to the procedure ?</strong>
<label>
<p>
<input type="radio" name="radio2" id="radio2" value="1" />
<input type="radio" name="radio2" id="radio2" value="2" />
<input type="radio" name="radio2" id="radio2" value="3" />
<input type="radio" name="radio2" id="radio2" value="4" />
<input type="radio" name="radio2" id="radio2" value="5" />
<br />
</p>
</label></td></tr><tr><td valign="top"><strong>How would you evaluate the pre- operative procedures (changing rooms, hair wash, haircut, etc) assisted by our Certified assistants / technicians prior to your procedure ?</strong>
<label>
<p>
<input type="radio" name="radio3" id="radio3" value="1" />
<input type="radio" name="radio3" id="radio3" value="2" />
<input type="radio" name="radio3" id="radio3" value="3" />
<input type="radio" name="radio3" id="radio3" value="4" />
<input type="radio" name="radio3" id="radio3" value="5" />
<br />
</p>
</label></td></tr><tr><td valign="top"><strong>How would you evaluate the procedure in terms of DHI Certified specialists' behavior ?</strong>
<label>
<p>
<input type="radio" name="radio4" id="radio4" value="1" />
<input type="radio" name="radio4" id="radio4" value="2" />
<input type="radio" name="radio4" id="radio4" value="3" />
<input type="radio" name="radio4" id="radio4" value="4" />
<input type="radio" name="radio4" id="radio4" value="5" />
<br />
</p>
</label></td></tr><tr><td valign="top"><strong>How would you evaluate the procedure in terms of DHI Certified Assistants' behavior ?</strong>
<label>
<p>
<input type="radio" name="radio5" id="radio5" value="1" />
<input type="radio" name="radio5" id="radio5" value="2" />
<input type="radio" name="radio5" id="radio5" value="3" />
<input type="radio" name="radio5" id="radio5" value="4" />
<input type="radio" name="radio5" id="radio5" value="5" />
<br />
</p>
</label></td></tr><tr><td valign="top"><strong>Did you find the procedure painful ?</strong>
<label>
<p>
<input type="radio" name="radio6" id="radio6" value="1" />
<input type="radio" name="radio6" id="radio6" value="2" />
<input type="radio" name="radio6" id="radio6" value="3" />
<input type="radio" name="radio6" id="radio6" value="4" />
<input type="radio" name="radio6" id="radio6" value="5" />
<br />
</p>
</label></td></tr><tr><td valign="top"><strong>How would you rate the operation room facilities (cleanliness, music, TV, comfort etc) ?</strong>
<label>
<p>
<input type="radio" name="radio7" id="radio7" value="1" />
<input type="radio" name="radio7" id="radio7" value="2" />
<input type="radio" name="radio7" id="radio7" value="3" />
<input type="radio" name="radio7" id="radio7" value="4" />
<input type="radio" name="radio7" id="radio7" value="5" />
<br />
</p>
</label></td></tr><tr><td valign="top"><strong>What are your first thoughts on the design & the distribution of the implanted hairs?</strong>
<label>
<p>
<input type="radio" name="radio8" id="radio8" value="1" />
<input type="radio" name="radio8" id="radio8" value="2" />
<input type="radio" name="radio8" id="radio8" value="3" />
<input type="radio" name="radio8" id="radio8" value="4" />
<input type="radio" name="radio8" id="radio8" value="5" />
<br />
</p>
</label></td></tr><tr><td valign="top"><strong>Would you recommend DHI to a frend of yours ?</strong>
<label>
<p>
<input type="radio" name="radio9" id="radio9" value="yes" />
<input type="radio" name="radio9" id="radio9" value="no" />
<br />
</p>
</label></td></tr>
<tr><td><strong> Suggestions</strong>
<label>
<p>
<textarea name="suggestions" cols="50" rows="10" id="suggestions"></textarea>
</p>
<p>
<label>
<input type="submit" name="submit" id="submit" value="Submit" />
</label>
<label>
<input type="reset" name="reset" id="reset" value="Reset" />
</label>
</p>
</label></td></tr></tbody></table>
</form>
</body>
</html>
これは私のphpです
<?php
$host="localhost";
$user_name="pramir_feedback";
$pwd="feedback";
$database_name="pramir_feedback";
$db=mysql_connect($host, $user_name, $pwd);
if (mysql_error() > "") print mysql_error() . "<br>";
mysql_select_db($database_name, $db);
if (mysql_error() > "") print mysql_error() . "<br>";
$waiting = $_POST['radio1'];
$consultation = $_POST['radio2'];
$preoperative = $_POST['radio3'];
$specialists = $_POST['radio4'];
$assistants = $_POST['radio5'];
$painful = $_POST['radio6'];
$operatingroom = $_POST['radio7'];
$thought = $_POST['radio8'];
$recommend = $_POST['radio9'];
$suggestions = $_POST['suggestions'];
$query = "insert into feedback (waiting, consultation, preoperative, specialists, assistants, painful, operatingroom, thought, recommend, suggestions) values ('" . $waiting . "', '" . $consultation . "', '" . $preoperative . "', '" . $specialists . "', '" . $assistants . "', '" . $painful . "', '" . $operatingroom . "', '" . $thought . "', '" . $recommend . "', '" . $suggestions . "')";
if (mysql_error() > "") print mysql_error() . "<br>";
$qresult = mysql_query($query);
echo "<h1>Thank you for submitting your details!</h1>";
?>