【发布时间】:2017-10-14 20:35:26
【问题描述】:
我正在x10hosting.com 上做一个测试项目,制作一个 HTML 表单,将文本框中的文本发送到内部数据库。我在连接 x10host PHPMyAdmin 和 x10host 代码时遇到问题。如果您能告诉我哪里出错了,我将不胜感激。下面附上我的代码。如果您有任何问题,请告诉我。谢谢。
index.php
<html>
<h2>Summary:</h2>
</p>
<form role="form" method="POST" action="process.php">
<label>Key Points</label>
<input type="text" id="keypoints" name="keypoints"/>
</br>
<input type="submit" id="submit" name="submit"/>
</form>
</html>
process.php
<?php
//Connecting to sql db.
$connect = mysqli_connect('localhost','infinote','','infinote_bank');
mysqli_select_db($connect,'infinote_bank');
//Sending form data to sql db.
if(isset($_REQUEST['submit'])) {
mysqli_query($connect, "INSERT INTO `cornell` (keypoints) VALUES ('$_POST['keypoints']')");
echo "success!";
}
?>
【问题讨论】:
-
了解参数化查询
标签: php html mysql forms phpmyadmin