Ok guys so I needed help on the php mysql script and javascript to use that would insert the current date on the “Completed” column and to make sure it gets added on the correct row and not on a row for another checkbox
[php]
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// When the "completed" button is clicked
$("#mybutton").click(function(event) {
// Prevent the normal page refresh.
event.preventDefault();
// If the checkbox is checked, get values
if($("#mycheckbox").is(":checked")) {
var checkbox = $("#mycheckbox").val(); // An example of how to get a value in your form
// If the checkbox is not checked, alert and end the script
} else {
alert("Please check the box");
return false;
}
// "POST" the values
$.ajax({
type: "POST",
url: "processpage.php",
data: {
// List the data you want sent, if it is a variable, no quotes are needed. If it is a word, use quotes.
'checkbox' : checkbox
},
// If it was successful
success: function(data){
alert("Form submitted successfully!");
}
});
});
});
</script>
<?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 "Title | Lecturer | Start | Due | Completed |
---|---|---|---|---|
" . $row['Title'] . " | "; echo "" . $row['Lecturer'] . " | "; echo "" . $row['Start'] . " | "; echo "" . $row['Due'] . " | "; echo "" .$row['Completed']. " "; echo " |
[/php]