Mam problem cały czas pokazuje mi łąd że błędne zapytanie do niezdefiniowanej funkji render form. w linji 79
<?php /*
EDIT RECORD
*/
// if the 'id' variable is set in the URL, we know that we need to edit a record
include('db.php');
{
// if the form's submit button is clicked, we need to process the form
if (isset($_POST['submit'])) {
// make sure the 'id' in the URL is valid
{
// get variables from the URL/form
$car = $_POST['car'];
$date = $_POST['date'];
$time = $_POST['time'];
$number = $_POST['number'];
$name = $_POST['name'];
$type = $_POST['type'];
$price = $_POST['price'];
// check that firstname and lastname are both not empty
if ($car == '' || $date == '' || $time == '' || $number == '' || $name == '' || $type =='' || $price == '')
{
// if they are empty, show an error message and display the form
$error = 'ERROR: Please fill in all required fields!';
renderForm($car, $date, $time, $number, $name, $type, $price, $error, $id);
}
else
{
// if everything is fine, update the record in the database
if ($stmt = $conn->prepare("UPDATE `booking` SET car = ?, date = ?, time = ?, number = ?, name = ?, type = ?, price = ?
WHERE id=?"))
{
$stmt->bind_param("sssi", $car, $date, $time, $number, $name, $type, $price, $id);
$stmt->execute();
$stmt->close();
}
// show an error message if the query has an error
else
{
echo "ERROR: could not prepare SQL statement."; }
// redirect the user once the form is updated
header("Location: booking.php"); }
}
// if the 'id' variable is not valid, show an error message
else
{
}
}
// if the form hasn't been submitted yet, get the info from the database and show the form
else
{
// make sure the 'id' value is valid
// get 'id' from URL
$id = $_GET['id'];
// get the recod from the database
if($stmt = $conn->prepare("SELECT * FROM `booking` WHERE id=?"))
{
$stmt->bind_param("i", $id);
$stmt->execute();
$stmt->bind_result($car, $date, $time, $number, $name, $type, $price, $id);
$stmt->fetch();
// show the form
renderForm($car, $date, $time, $number, $name, $type, $price, NULL, $id);
$conn->close();
}
// show an error if the query has an error
else
{
echo "Error: could not prepare SQL statement"; }
// if the 'id' value is not valid, redirect the user back to the view.php page
header("Location: booking.php");
}
}
?>
Ktos podpowie, pomoze?