Just spent a crazy morning coaching boys, cleaning up after a toddler and modifying this http://jalt-publications.org/tlt/departments/tlt-wired/articles/700-saving-hot-potatoes-quiz-results-database to get it to work.
Most of the article is great, but its php is growing old. mysql_connect is deprecated in PHP 5.5 (I’m using 5.4.something, but still good to update)
Here is my slant on the required php script:
<?php $realname = $_POST['realname']; $Exercise = $_POST['Exercise']; $Score = $_POST['Score']; $Start_Time = $_POST['Start_Time']; $End_Time = $_POST['End_Time']; // Connect to the local database using username and password. $link = mysqli_connect ("127.0.0.1", "username", "password", "databasename") or die("Error " . mysqli_error($link)); $query = "INSERT INTO tablename (realname, Exercise, Score, Start_Time, End_Time) VALUES ('$realname', '$Exercise', '$Score', '$Start_Time', '$End_Time')"; $result = mysqli_query($link, $query) or die("Error " . mysqli_error($result)); //Provide some feedback to the student. echo ("Your answers have been saved!"); ?>
So, with that php script somewhere on the internet, go to your hotpotato quiz, Options > Configure Output > pick the CGI tab > tick the button to submit results through CGI, paste in the URL of whereever you’ve put your php script, save there, close, save the quiz, make the quiz into html or use masher to make the html. Test it out.
One more thing, in myphpadmin, you probably could do with a primary key for your database. Make another field called id, type INT, auto increment and that should work.