Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
post for jasonette demo form.json
require_once '../../_includes/connect.php';
$userName = $_REQUEST["userName"];
$userEmail = $_REQUEST["userEmail"];
$lastSeries = $_REQUEST["lastSeries"];
//define table
$tbl = "users";//change to your table i.e. John_app
//write query
$query = "INSERT INTO $tbl (userName, userEmail, lastSeries) VALUES (?,?,?)";
//prepare statement, execute, store_result
if($insertStmt = $mysqli->prepare($query)){
$insertStmt->bind_param("sss", $userName, $userEmail, $lastSeries);
$insertRows = $insertStmt->affected_rows;
echo("<br>Oops there was an error: $insertStmt->error");
//if the info got inserted
if($insertRows > 0){
echo("<br>Thanks $userName we have saved your info: $userEmail.
<p>not really of course</p>");
echo("<br>Sorry, there was a problem saving your info.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment