I enter the data into the database through the form in a separate file and send it by the POST method. But for some reason the data in the database do not appear, what am I doing wrong? help me please

<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Добавление клиента</title> </head> <body> <form method="post" action="add.php"> клиент<br/> <input type="text" name="klient" /><br/> ОП_форма <br/> <textarea name="op_firma" ></textarea> <br/> <!-- cols="10" rows="10" --> Наимен <br/> <input type="text" name="naimen" /><br/><br/> отрасль <br/> <input type="text" name="otrasl" /><br/><br/> telefon <br/> <input type="text" name="telefon" /><br/><br/> email <br/> <input type="text" name="email" /><br/><br/> ОП фирмы <br/> <input type="text" name="kont_lico" /><br/><br/> ОП фирмы <br/> <input type="text" name="dolznost" /><br/><br/> <input type="hidden" name="date" value="<?php echo date ('Ym-d');?>" /> <input type="hidden" name="time" value="<?php echo date ('Hi-s');?>" /> <input type="submit" name="add" value="Добавить" /> </form> <?php $connection=mysql_connect("localhost","reklama","reklama") ; $db=mysql_select_db(reklama); mysql_set_charset("utf8"); if (!$connection || !$db) { exit(mysql_error()); } if (isset($_POST['add'])) { $klient = strip_tags(trim($_POST ['klient'])) ; $op_firma=strip_tags(trim($_POST ['op_firma'])) ; $naimen=strip_tags(trim($_POST ['naimen'])) ; $otrasl=strip_tags(trim($_POST ['otrasl'])) ; $telefon=strip_tags(trim($_POST['telefon'])) ; $email=strip_tags(trim($_POST ['email'])) ; $kont_lico=strip_tags(trim($_POST ['kont_lico'])) ; $dolznost=strip_tags(trim($_POST ['dolznost'])) ; $date = $_POST['date']; $time = $_POST['time']; mysql_query(" INSERT INTO klienti(klient,op_firma,naimen,otrasl,telefon,email,kont_lico,dolznost,date,time) VALUES ('$klient', '$op_firma', '$naimen', '$otrasl', '$telefon', '$email', '$kont_lico',$dolznost', '$date', '$time') "); mysql_close(); echo "Новость успешно добавлена"; } ?> </body> </html> 

Closed due to the fact that off-topic participants cheops , aleksandr barakin , Kirill Stoianov , αλεχολυτ , Streletz 24 Sep '16 at 2:35 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - cheops, aleksandr barakin, Kirill Stoianov, αλεχολυτ
If the question can be reformulated according to the rules set out in the certificate , edit it .

    2 answers 2

    Try it like this.

     <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Добавление клиента</title> </head> <body> <form method="post" action="add.php"> клиент<br/> <input type="text" name="klient" /><br/> ОП_форма <br/> <textarea name="op_firma" ></textarea> <br/> <!-- cols="10" rows="10" --> Наимен <br/> <input type="text" name="naimen" /><br/><br/> отрасль <br/> <input type="text" name="otrasl" /><br/><br/> telefon <br/> <input type="text" name="telefon" /><br/><br/> email <br/> <input type="text" name="email" /><br/><br/> ОП фирмы <br/> <input type="text" name="kont_lico" /><br/><br/> ОП фирмы <br/> <input type="text" name="dolznost" /><br/><br/> <input type="hidden" name="date" value="<?php echo date ('Ym-d');?>" /> <input type="hidden" name="time" value="<?php echo date ('Hi-s');?>" /> <input type="submit" name="add" value="Добавить" /> </form> <?php $connection=mysql_connect("localhost","reklama","reklama") ; $db=mysql_select_db('reklama'); mysql_set_charset("utf8"); if (!$connection || !$db) { exit(mysql_error()); } if (isset($_POST['add'])) { $klient = strip_tags(trim($_POST['klient'])) ; $op_firma=strip_tags(trim($_POST['op_firma'])) ; $naimen=strip_tags(trim($_POST['naimen'])) ; $otrasl=strip_tags(trim($_POST['otrasl'])) ; $telefon=strip_tags(trim($_POST['telefon'])) ; $email=strip_tags(trim($_POST['email'])) ; $kont_lico=strip_tags(trim($_POST['kont_lico'])) ; $dolznost=strip_tags(trim($_POST['dolznost'])) ; $date = $_POST['date']; $time = $_POST['time']; mysql_query(" INSERT INTO klienti(klient,op_firma,naimen,otrasl,telefon,email,kont_lico,dolznost,date,time) VALUES ('{$klient}', '{$op_firma}', '{$naimen}', '{$otrasl}', '{$telefon}', '{$email}', '{$kont_lico}','{$dolznost}', '{$date}', '{$time}') "); mysql_close(); echo "Новость успешно добавлена"; } ?> </body> </html> 
    • Anyway, no entry - roman

    I executed my request in phpmyadmin and saw an error, it was in my inattention, the field in the database was 'op_forma', and I wrote 'op_firma'.