Date of Birth does not show and Form cannot edit in PHP

one text

Solution:

The date of birth issue: extra space at the end of your value tag

value="<?php echo $students['dob'] ?> "

The database issues:

  • malformed update statement
  • insecure, open-to-attack query

You kind of mixed insert and update.

UPDATE students(student_id, first_name, last_name, email, dob) 
SET student_id = '$student_id', first_name = '$first_name', last_name = '$last_name', email = '$email', dob = '$dob'
WHERE id = '$id'

Update statements don't take a field list in parens like you have it. So the statement is failing. However you should really protect again SQL injection attacks by using query binding and prepared statements. Looks like this:

$sql = "UPDATE students SET student_id = '?', first_name = '?', last_name = '?', email = '?', dob = '?' WHERE id = '?'"; 
$query = $mysqli->prepare($sql);
$query->bind_param("isssi", $student_id, $first_name, $last_name, $email, $dob, $id);
$query->execute();

https://www.w3schools.com/php/php_mysql_prepared_statements.asp

Source