Face insert la refresh-ul paginii
Scris: Joi Apr 06, 2017
Salutare,
Am urmatorul cod:
La prima deschidere a paginii if-ul returneaza false (nu exista submit), dupa apasarea butonului de submit la fiecare refresh al paginii se executa if-ul in true.
Unde ramane agatat $_POST['submit'] ?
Multumesc!
Am urmatorul cod:
Cod: SelectaĊ£i tot
<?php
$conn = mysqli_connect("localhost","root","","bd");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if(isset($_POST['submit'])) {
$pass = $_POST['pass'];
$pass_hash = password_hash($pass, PASSWORD_DEFAULT);
$sql = "INSERT INTO user (PASS) VALUES ('$pass_hash')";
$result = mysqli_query($conn, $sql);
echo 'exista submit';
}
else {
echo "nu exista submit";
}
?>
<form action="" method="POST">
<input type="text" name="pass" />
<input type="submit" name="submit" />
</form>
Unde ramane agatat $_POST['submit'] ?
Multumesc!