I have a simple form with following fields Auditor, departement, date, weeknr, registration (i have them in dutch..) PHP is a problem since i don't know it too well.
So 2 question's here:
My date field is a jQuery datepicker and returns (07/19/2019) but in mysql I only get 0000-00-00,
Also i would like to have an ID based on the values of some of those fields that a user fills in. Already tried to search how to do it but can't find good examples. So my ID would be something like: departement_weeknr (for example..)
I looked at other examples of code online, but since i don't know PHP it is difficult for me to integrate it.
This is my code how I store all the information
if (isset($_POST['register_form'])) {
// receive all input values from the form
$Auditor = mysqli_real_escape_string($db, $_POST['Auditor']);
$Afdeling = mysqli_real_escape_string($db, $_POST['Afdeling']);
$Datum = mysqli_real_escape_string($db, $_POST['Datum']);
$Week = mysqli_real_escape_string($db, $_POST['Week']);
$Aanmelding = mysqli_real_escape_string($db, $_POST['Aanmelding']);
$query="INSERT INTO 6saudits (Auditor,Afdeling,Datum,Week,Aanmelding) VALUES ('$Auditor','$Afdeling','$Datum','$Week','$Aanmelding')";
$datum = date('Y-m-d', strtotime(str_replace('-', '/', $datum)));
mysqli_query($db, $query);
I hope someone can help me with the date and ID part, so it would be stored properly in mysql table
Edit SQL table:
CREATE TABLE IF NOT EXISTS `6saudits` (
`ID` int(50) NOT NULL AUTO_INCREMENT,
`Auditor` varchar(50) NOT NULL,
`Afdeling` varchar(50) NOT NULL,
`Datum` date NOT NULL,
`Week` int(20) NOT NULL,
`Aanmelding` varchar(50) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=17 ;