Skip to content

Instantly share code, notes, and snippets.

@ramytamer
Created April 14, 2015 00:20
Show Gist options
  • Select an option

  • Save ramytamer/d44c50cb276aba2cf9d6 to your computer and use it in GitHub Desktop.

Select an option

Save ramytamer/d44c50cb276aba2cf9d6 to your computer and use it in GitHub Desktop.
ateg
<html>
<head>
</head>
<body>
<form action="" method="post">
<input type="text" name="response" placeholder="Your response">
<input type="submit" value="OK">
</form>
<?php
echo "<pre>", print_r($_POST), "</pre>";
if (isset($_POST['response']) && !empty($_POST['response'])) {
// because we used name = response in input field
$response = $_POST['response'];
$db = new mysqli("localhost", "root", "r.134679+", "atef");
$sql = $db->prepare(" INSERT INTO `responses` (`response`) VALUES (?) ");
$sql->bind_param('s', $response);
$sql->execute();
}
?>
<script>
// document.getElementsByTagName('form')[0].submit();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment