toto my vypise iba nadpis a nic viac a neprida do databazy nic. nevyhodi ani chybu tak neviem kde som sa pomylil alebo ci tam daco chyba
Kód:
<h1>Results</h1>
<?php
$fromairport = $_POST['fromairport'];
$toairport = $_POST['toairport'];
$departing = $_POST['departing'];
$price = $_POST['price'];
if (!$fromairport || !$toairport || !$departing || !$price)
{
echo 'not enought information, Go back and fill all fields';
exit;
}
if (!get_magic_quotes_gpc())
{
$fromairport = addslashes($fromairport);
$toairport = addslashes($toairport);
$departing = addslashes($departing);
$price = doubleval($price);
}
@ $db = new mysqli('localhost', 'root', '', 'tables');
if (mysqli_connect_errno())
{
echo 'Error: cannot connect to database, try again later';
exit;
}
$query = "insert into holidays values
('".$fromairport."', '".$toairport."', '".$departing."', '".$price."')";
$result = $db->query($query);
if ($result)
echo 'Inserted into database: '.$db->affected_rows;
$db->close();
?>