I'm trying to get a form submission to automatically save the date when submitted, but I suspect that one of my variables is not right.
There are these two variables:
Then I'm inserting it like so:
I'm wondering if the $current_date variable is my problem and how to fix it.
There are these two variables:
Code:
$timestamp = $_POST['date'];
$current_date = date('j/M/y', $timestamp);
Code:
if(isset($_POST['submit'])){
$query = "INSERT INTO news (`headline`, `body`, `image`, `date`)
VALUES ('$headline', '$body', '$image', $current_date);";
$result = $mysqli->query($query);
}
Comment