tan update in database
This commit is contained in:
parent
c949aebc85
commit
57262adcb7
20
entry.php
20
entry.php
@ -1,12 +1,26 @@
|
|||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<script src="js/newEntry.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
Deine Tan ist:
|
<form id="entry-form" action="php/addEntry.php" method="post">
|
||||||
|
Vorname:<br>
|
||||||
<?php echo $_GET["tan"]; ?>
|
<input type="text" name="vorname"><br>
|
||||||
|
Nachname:<br>
|
||||||
|
<input type="text" name="nachname"><br>
|
||||||
|
E-Mail:<br>
|
||||||
|
<input type="text" name="email"><br>
|
||||||
|
Nachricht:<br>
|
||||||
|
<input type="text" name="eintrag"><br>
|
||||||
|
<input type="hidden" name="tan" value="<?php echo $_GET["tan"]?>"><br>
|
||||||
|
<input id="absenden" type="submit" value="Abschicken">
|
||||||
|
<button type="reset">Loeschen</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
0
js/newEntry.js
Normal file
0
js/newEntry.js
Normal file
32
php/addEntry.php
Normal file
32
php/addEntry.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
consumeTan($_POST['tan']);
|
||||||
|
echo "Tan verbraucht " . $_POST['tan'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function addEntry() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function consumeTan($tan) {
|
||||||
|
//Stelle DB verbindung her
|
||||||
|
$user = 'root';
|
||||||
|
$password = 'root';
|
||||||
|
$db = 'friendsbook';
|
||||||
|
$host = 'localhost';
|
||||||
|
$port = 3306;
|
||||||
|
|
||||||
|
$database = new mysqli($host, $user, $password, $db, $port);
|
||||||
|
|
||||||
|
if ($database->connect_error) {
|
||||||
|
die('Connect Error (' . $database->connect_errno . ') ' . $database->connect_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
$update = $database->query("UPDATE `tans` SET `used`= true WHERE `tan` = '" . $_POST['tan'] . "'");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user