フォームからテーブルに値を挿入しようとしています。
ここに私が使用した私のコードがあります
insert.php のコード
<?php
// Make a MySQL Connection
mysql_connect("localhost", "tiger", "tiger") or die(mysql_error());
mysql_select_db("theaterdb") or die(mysql_error());
// Insert a row of information into the table "language"
mysql_query("INSERT INTO languages (language) VALUES('$_POST[language]') ")
or die(mysql_error());
echo "Data Inserted!";
?>
HTMLフォーム
<html>
<head></head>
<body>
<form action="insert.php" method="post">New Language:
<input type="text" name="language">
<input type="submit" value="Create Language">
</form>
</body>
</html>
しかし、insert.php ファイルを使用したくありません。代わりに、insert.html で php コードを使用したいと考えています。使ってみた
<form action="">
そしてまた
<form action="#">
と
<form action="<?php echo $PHP_SELF;?>">
しかし、それは機能していません。