如何從2個文本字段輸入一個數字範圍,這是我的代碼似乎不工作,範圍函數我希望它被插入到mysql數據庫,但這段代碼只是來測試我是否可以得到2個文本框連接到範圍函數。任何人都可以幫助我解決這個問題?輸入一個數字範圍到mysql數據庫
<?php
$from = '.from';
$to = '.to';
$number = range('$from','$to');
print_r ($number);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>New Waybill</title>
<link rel="shortcut icon" href="../img/icon.ico">
<link rel="stylesheet" type="text/css" href="../css/forms.css" />
</head>
<body>
<form id="form3" name="form1" method="post" action="">
<p>From:
<input type="text" name="from" id="form_number" class="from" value="0"/>
- To:
<input type="text" name="to" id="form_number" class="to" value="50" />
</p>
<p>Waybill Booklet:
<select name="waybill_booklet" id="form_list">
</select>
</p>
<p>
<input type="submit" name="button" id="form_button" value="OK!" />
</p>
</form>
</body>
</html>
你的意思是做'$ from = $ _POST ['from'];'? –
您是否期待'$ from ='.from';'將選擇輸入字段與類'from'? (這是PHP,而不是JS?!)很難說出你在這裏想做什麼 - 但是看起來好像你在混合概念和編程語言。 – feeela
我想把數字範圍的數據庫例如用戶輸入1和10然後它會插入1 2 3 4 5 6 7 8 9 10 – Willard