Last active
September 25, 2017 14:29
-
-
Save brucenorton/d03c6262a9451a6719f513c6d88a20c8 to your computer and use it in GitHub Desktop.
post for jasonette demo form.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
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); | |
$insertStmt->execute(); | |
$insertRows = $insertStmt->affected_rows; | |
}else{ | |
echo("<br>Oops there was an error: $insertStmt->error"); | |
echo("<br>$mysqli->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>"); | |
}else{ | |
echo("<br>Sorry, there was a problem saving your info."); | |
} | |
$insertStmt->close(); | |
$mysqli->close(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment