これを変更する-
// insert a row
$stu_name = "Joe";
$stu_email = "[email protected]";
$stu_city = "Joeland";
$stmt->execute();
// insert another row
$stu_name = "Mary";
$stu_email = "[email protected]";
$stu_city = "Maryland";
$stmt->execute();
これに-
// insert a row
$stu_name = $_POST['stu_name'];
$stu_email = $_POST['stu_email'];
$stu_city = $_POST['stu_city'];
$stmt->execute();
フォームはPHPのPOST配列に値を配置し、フォームからnameプロパティで値にアクセスできます。