First upload
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('display_startup_errors', '1');
|
||||
error_reporting(E_ALL);
|
||||
// Connessione al database (assicurati di avere le tue credenziali)
|
||||
include('Connections/bkngstm.php');
|
||||
|
||||
|
||||
// Crea una connessione al database
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
// Controlla la connessione
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Assicurati che tutti i dati POST necessari siano presenti
|
||||
if (
|
||||
isset($_POST['formrow-firstname-input']) &&
|
||||
isset($_POST['surname-input']) &&
|
||||
isset($_POST['formrow-email-input']) &&
|
||||
isset($_POST['example-date-input']) &&
|
||||
isset($_POST['ticket']) &&
|
||||
isset($_POST['formrow-inputState'])
|
||||
) {
|
||||
|
||||
// Prendi i dati dal modulo
|
||||
$first_name = $_POST['formrow-firstname-input'];
|
||||
$last_name = $_POST['surname-input'];
|
||||
$order_billing_email = $_POST['formrow-email-input'];
|
||||
$order_date_created = $_POST['example-date-input'];
|
||||
$nticket = $_POST['ticket'];
|
||||
$quantityclass = $_POST['ticket'];
|
||||
$idservice = $_POST['formrow-inputState'];
|
||||
$quantity = 1;
|
||||
$status = "pending";
|
||||
$cod = $_POST['cod'];
|
||||
$userid = isset($_POST['userid']) && !empty($_POST['userid']) ? $_POST['userid'] : NULL;
|
||||
|
||||
|
||||
// Prepara la query SQL
|
||||
$sql = "INSERT INTO orderbook (first_name, last_name, order_billing_email, order_date_created, nticket, quantityclass, idservice, quantity, status, cod, iduser)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->bind_param("sssssssissi", $first_name, $last_name, $order_billing_email, $order_date_created, $nticket, $quantityclass, $idservice, $quantity, $status, $cod, $userid);
|
||||
|
||||
|
||||
if ($stmt->execute()) {
|
||||
echo "Ordine inserito con successo!";
|
||||
// Reindirizzamento a orderbooklist.php dopo aver inserito con successo l'ordine
|
||||
header("Location: orderbooklist.php");
|
||||
exit; // Assicurati di chiamare exit() dopo header() per fermare l'esecuzione dello script
|
||||
} else {
|
||||
echo "Errore: " . $stmt->error;
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
} // Questa è la parentesi graffa che mancava
|
||||
?>
|
||||
Reference in New Issue
Block a user