[請益] 表單、資料庫
請問各位大大
我想要把在兩格表單裡的資料上傳到資料庫裡面
這樣對嗎?
HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title> test </title>
</head>
<body>
<form name="forml" method="get" action="ch3-7-1.php">
<p>姓名:
<input name="name" type="text" id="name">
</p>
<p>學校:
<input name="school" type="text" id="school">
</p>
<p>
<input type="submit" name="Submit" value="送出">
<input type="reset" name="Submit2" value="重設">
</p>
</from>
</body>
</html>
這是ch3-7-1.php
<?php
$link = mysql_connect("■■■", "■■■", "■■■") or die("無法連接資料庫
");
mysql_select_db("test") or die("無法選擇資料庫");
$query = "INSERT INTO test (sch_id, name, score) VALUES ('00001','$name',
'$school')";
mysql_query($query) or die("無法送出" . mysql_error( ));
?>
這樣可以成功嗎?
能不能直接從資料庫看到輸入的值?
如果輸入很多次 能不能按照順序讓sch_id從00001 > 00002 > 00003 ?
先感謝大大了~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.134.31.123
※ 編輯: momogen 來自: 220.134.31.123 (03/19 21:17)
推
03/19 21:33, , 1F
03/19 21:33, 1F
→
03/19 21:36, , 2F
03/19 21:36, 2F
推
03/19 22:29, , 3F
03/19 22:29, 3F
→
03/19 22:31, , 4F
03/19 22:31, 4F
→
03/19 22:52, , 5F
03/19 22:52, 5F
推
03/19 23:09, , 6F
03/19 23:09, 6F
→
03/19 23:10, , 7F
03/19 23:10, 7F
→
03/19 23:19, , 8F
03/19 23:19, 8F
→
03/19 23:21, , 9F
03/19 23:21, 9F
→
03/19 23:22, , 10F
03/19 23:22, 10F
推
03/19 23:30, , 11F
03/19 23:30, 11F
→
03/19 23:32, , 12F
03/19 23:32, 12F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
4
12
PHP 近期熱門文章
PTT數位生活區 即時熱門文章
4
11