12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <!DOCTYPE html>
- <html>
- <meta charset="utf-8">
- <body>
- <?php include 'submitdatabaseinfo.php';?>
- <?php
- function clean_input($data) {
- $data = trim($data);
- $data = stripslashes($data);
- $data = htmlspecialchars($data);
- return $data;
- }
- $comment = $_POST['comment'];
- $grammarandspelling = $_POST['grammarandspelling'];
- $themeandplot = $_POST['themeandplot'];
- $style = $_POST['style'];
- $culturalrelevance = $_POST['culturalrelevance'];
- $overallimpression = $_POST['overallimpression'];
- $id = $_POST['id'];
- $voterid = $_POST['voterid'];
- $comment = clean_input($comment);
- $grammarandspelling = clean_input($grammarandspelling);
- $themeandplot = clean_input($themeandplot);
- $style = clean_input($style);
- $culturalrelevance = clean_input($culturalrelevance);
- $overallimpression = clean_input($overallimpression);
- $voterid = clean_input($voterid);
- // Create connection
- $conn = mysqli_connect($servername, $username, $password, $dbvotes);
- // Check connection
- if (!$conn) {
- die("Database connection failed: " . mysqli_connect_error());
- }
- mysqli_set_charset($conn, "utf8");
- $comment=mysqli_real_escape_string($conn,$comment);
- $grammarandspelling=mysqli_real_escape_string($conn,$grammarandspelling);
- $themeandplot=mysqli_real_escape_string($conn,$themeandplot);
- $style=mysqli_real_escape_string($conn,$style);
- $culturalrelevance=mysqli_real_escape_string($conn,$culturalrelevance);
- $overallimpression=mysqli_real_escape_string($conn,$overallimpression);
- $voterid=mysqli_real_escape_string($conn,$voterid);
- $id=mysqli_real_escape_string($conn,$id);
- $sql = "INSERT INTO votes ( voterid, storyid, comment, grammarandspelling,
- themeandplot, style, culturalrelevance,
- overallimpression)
- VALUES ( '" .$voterid. "','" .$id. "','" .$comment. "',
- '" .$grammarandspelling. "','" .$themeandplot. "',
- '" .$style. "','" .$culturalrelevance. "',
- '" .$overallimpression. "')";
- if (mysqli_query($conn, $sql)) {
- echo "Your evaluation has been successfully recorded";
- } else {
- echo "Error recording your evaluation, please contact lugha@tuvutepamoja.africa.";
- //echo $sql . "<br>" . mysqli_error($conn);
- }
- mysqli_close($conn);
- exit();
- ?>
- </body>
- </html>
|