Witam, mógłby ktoś mi pomóc znaleźć błąd w kodzie poniżej?
Kod ma za zadanie dodawać dane do bazy czego niestety nie robi, następuje przekierowanie do strony udalo-sie.php tak jak by wszystko się udało jednak w tabeli nie ma nowych danych.
<?php
include( 'connect.php' );
if( isSet( $_POST['title'] ) ) {
$sth = $connect->prepare( 'INSERT INTO `ad`(`id_user`, `title`, `cat_ad`, `ci_ad`, `content_ad`, `price_ad`, `email_ad`, `name_ad`, `loc_ad`, `phone_ad`, `stan_ad`, `stan2_ad`, `who_ad`, `war_ad`, `tra_ad`, `ph1_ad`, `ph2_ad`, `ph3_ad`, `ph4_ad`) VALUES (:id_user,:title,:cat_ad,:ci_ad,:content_ad,:price_ad,:email_ad,:name_ad,:loc_ad,:phone_ad,:stan_ad,:stan2_ad,:who_ad,:war_ad,:tra_ad,:ph1_ad,:ph2_ad,:ph3_ad,:ph4_ad)' );
$sth->bindParam( ':id_user', $_SESSION['id_user'] );
$sth->bindParam( ':title', $_POST['title'] );
$sth->bindParam( ':cat_ad', $_POST['cat_ad'] );
$sth->bindParam( ':ci_ad', $_POST['ci_ad'] );
$sth->bindParam( ':content_ad', $_POST['content_ad'] );
$sth->bindParam( ':price_ad', $_POST['price_ad'] );
$sth->bindParam( ':email_ad', $_POST['email_ad'] );
$sth->bindParam( ':name_ad', $_POST['name_ad'] );
$sth->bindParam( ':loc_ad', $_POST['loc_ad'] );
$sth->bindParam( ':phone_ad', $_POST['phone_ad'] );
$sth->bindParam( ':stan_ad', $_POST['stan_ad'] );
$sth->bindParam( ':stan2_ad', $_POST['stan2_ad'] );
$sth->bindParam( ':who_ad', $_POST['who_ad'] );
$sth->bindParam( ':war_ad', $_POST['war_ad'] );
$sth->bindParam( ':tra_ad', $_POST['tra_ad'] );
$sth->bindParam( ':ph1_ad', $_POST['ph1_ad'] );
$sth->bindParam( ':ph2_ad', $_POST['ph2_ad'] );
$sth->bindParam( ':ph3_ad', $_POST['ph3_ad'] );
$sth->bindParam( ':ph4_ad', $_POST['ph4_ad'] );
$sth->execute();
header( 'location: udalo-sie.php' );
}
?>