html 数据项放在 标签,如何在HTML中传递数据选择选项标签?
得到你需要制作一個(gè)與基于銀行賬戶號(hào)碼列中的所有數(shù)據(jù)數(shù)據(jù)庫(kù)Select聲明傳遞的銀行帳號(hào)作為變量。然后將該語(yǔ)句存儲(chǔ)為變量,并將其傳遞到數(shù)據(jù)庫(kù),該數(shù)據(jù)庫(kù)將返回任何匹配項(xiàng)。如:
bank_no1
bank_no2
bank_no3
// make a connection to your MySQLi server using credentials
$conn = new mysqli($servername, $username, $password, $dbname);
// get the form data from the bank_name select
$bank_noX = $_POST["bank_name"];
// construct an SQL string passing in the bank number
$sql = "Select * FROM Accounts WHERE bank_name IS " . $bank_noX;
// query the SQL database using our established connection and store in $result
$result = $conn->query($sql);
?>
那么你的結(jié)果是銀行數(shù)量在$result,您可以用$result->fetch_assoc()解析數(shù)據(jù)。例如,
while($row = $result->fetch_assoc()) {
printf("Bank ID: " . $row['bank_id'] . ", Hello " . $row['account_name']);
}
這是假設(shè)你有一個(gè)MySQLi數(shù)據(jù)庫(kù)和一個(gè)到它的連接。
總結(jié)
以上是生活随笔為你收集整理的html 数据项放在 标签,如何在HTML中传递数据选择选项标签?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: html兄弟选择器怎么用,CSS的相邻兄
- 下一篇: html5标签及属性大全,HTML5 标