Změnit toto -
// insert a row
$stu_name = "Joe";
$stu_email = "joe@example.com";
$stu_city = "Joeland";
$stmt->execute();
// insert another row
$stu_name = "Mary";
$stu_email = "mary@example.com";
$stu_city = "Maryland";
$stmt->execute();
na toto -
// insert a row
$stu_name = $_POST['stu_name'];
$stu_email = $_POST['stu_email'];
$stu_city = $_POST['stu_city'];
$stmt->execute();
Váš formulář umístí hodnoty do pole POST PHP a můžete k nim přistupovat pomocí vlastnosti name z formuláře.