<?php
require_once 'connect.php';
if (isset($_POST['insert'])) {
$sql = 'SQL文を記述';
$sth = $dbh->prepare($sql);
//挿入するデータの指定を記述
$sth->bindValue('' , , PDO::PARAM_STR);
$sth->bindValue('' , , PDO::PARAM_INT);
$sth->execute();
exit;
}
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>追加画面</title>
</head>
<body>
<h1>追加画面</h1>
<h2>TODO</h2>
<form action="add.php" method="post">
<input type="text" name="detail" size="50" maxlength="50" required>
<select name="priority">
<option value="1">高
<option value="0">低
</select>
<br><br>
<input type="submit" name="insert" value="追加">
</form>
</body>
</html>
$dsn = 'mysql:dbname=honki_todo;host=localhost;charset=utf8mb4';
<?php
require_once 'connect.php';
if (isset($_POST['insert'])) {
$sql = 'SQL文を記述';
$sth = $dbh->prepare($sql);
//挿入するデータの指定を記述
$sth->bindValue('' , , PDO::PARAM_STR);
$sth->bindValue('' , , PDO::PARAM_INT);
$sth->execute();
exit;
}
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>追加画面</title>
</head>
<body>
<h1>追加画面</h1>
<h2>TODO</h2>
<form action="add.php" method="post">
<input type="text" name="detail" size="50" maxlength="50" required>
<select name="priority">
<option value="1">高
<option value="0">低
</select>
<br><br>
<input type="submit" name="insert" value="追加">
</form>
</body>
</html>
<?php
$dsn = 'mysql:dbname=honki_todo;host=localhost;charset=utf8mb4';