hab folgendes Problem:
Habe ein Script, welches per $_POST['value']; halt die POST DATA bekommen soll.
Nun aber bekomme ich keine POST DATA und die SQL row bleibt blank.
Code:
Code:
<?php
require("../common.php");
$id = $_SESSION['user']['id'];
$code = $_POST['code'];
$host = "127.0.0.1";
$username = "";
$password = "";
$dbname = "";
try {
$conn = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "UPDATE user SET code='$code' WHERE id='$id'";
// Prepare statement
$stmt = $conn->prepare($sql);
// execute the query
$stmt->execute();
}
catch(PDOException $e)
{
echo $sql . "<br>" . $e->getMessage();
}
$conn = null;
?>
<html>
<form action="?" method="post" class="form">
<div class="form-group">
<label for="sel1">Lizens:</label>
<select class="form-control" id="sel1">
<option></option>
</select>
</div> <br>
<div class="form-group">
<label for="code">Code:</label>
<input type="text" onkeypress="return isNumberKey(event)" class="form-control" id="code" pattern=".{16,}" required title="16 characters minimum" maxlength="16" placeholder="1234123412341234">
</div>
<button type="submit" class="btn btn-default">submit</button>
</form>
</html>






