Insert Current date to Table When button clicked

[php]

<?php $con=mysqli_connect("localhost","root","","User_db"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT * FROM Assessments"); echo ""; while($row = mysqli_fetch_array($result)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
Title Lecturer Start Due Completed
" . $row['Title'] . "" . $row['Lecturer'] . "" . $row['Start'] . "" . $row['Due'] . "" . $row['Completed'] . "
"; mysqli_close($con); ?>

[/php]

[php]

<?php $con=mysqli_connect("localhost","root","","User_db"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $strCompleted = $_POST['Completed']; if ($strCompleted == "Completed") { $strCompleted = "NOW()"; } else { $strCompleted = ""; } $sql="INSERT INTO Assessments (Title, Lecturer, Start, Due, Completed) VALUES ('$_POST[Title]','$_POST[Lecturer]','$_POST[Start]','$_POST[Due]','$strCompleted')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error()); } header( "Location: Assessment_Calendar.php" ) ; mysqli_close($con); ?>

[/php]

Hi guys I was wondering if, using JQuery or anything possible, I could could click on the “Completed” button and it would check the date on which it was created and it would enter that detail in the “Completed” column
In my Assessment table in the sql database

Sponsor our Newsletter | Privacy Policy | Terms of Service