I have two fields in the database with dates date, date1 and the date in them is now displayed like this: 2016-09-25. I want to do this: 25-09-2016. Tried to change the format to: dmY, but displays the date on the site.
Help me please.
In the file that displays the data from the database, the query is:
$rezult=mysql_query("SELECT * FROM klienti"); In the file that adds the request, the code is:
<!DOCTYPE html> <html> <head> <script type="text/javascript" src="calendar/tcal.js"></script> <!-- //календарь --> <link rel="stylesheet" type="text/css" href="calendar/tcal.css" /> <!-- //календарь --> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Добавление клиента</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript"> $("document").ready(function() { $ ("form").submit(function(event){ event.preventDefault(); // !!! var dannie = $("form").serialize(); $.ajax({ url:'insert.php', type: 'POST', data: dannie, success: function (data) { if (data) { alert("Успешно добавлена") ; } else { alert("Ошибка"); } } }); }); }); </script> </head> <body> <form> клиент<br/> <input type="text" name="klient" /><br/> ОП_форма <br/> <textarea name="op_forma" ></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 ('dm-Y');?>" /> <input type="hidden" name="time" value="<?php echo date ('H:i:s');?>" /> <br/> <input type="text" name="date1" class="tcal" value="" /> <br/> <input type="submit" id="send" value="Добавить" /> <input type="button" name="reset_form" value="Очистить форму" onclick="this.form.reset();"> </form> </body> </html> In the file responsible for inserting into the database
<?php $connection=mysql_connect("localhost","reklama","reklama") ; mysql_select_db('reklama'); mysql_set_charset("utf8"); $ret=true; mysql_query(" INSERT INTO `klienti` (klient,op_forma,naimen,otrasl,telefon,email,kont_lico,dolznost,date,date1,time) VALUES ('". $_POST ['klient'] ."' , '" . $_POST ['op_forma'] ."', '" . $_POST ['naimen'] ."', '" . $_POST ['otrasl'] ."', '" . $_POST ['telefon'] ."', '" . $_POST ['email'] ."', '" . $_POST ['kont_lico'] ."', '" . $_POST ['dolznost'] ."', '" . $_POST ['date'] ."', '" . $_POST ['date1'] ."', '" . $_POST ['time'] ."')") or $ret=false; echo $ret; ?>