作者kitleong (gogogo)
看板Web_Design
標題Re: [問題] Submit後input不變
時間Mon Oct 9 13:56:47 2006
※ 引述《DennisKao (dk)》之銘言:
: 目前想做一個功能:
: 畫面上有許多checkbox與radio,在按下Submit送出資料後(ASP)
: 導回原來的網頁時,可以留下剛才的輸入(勾選的checkbox)
: 不知是要使用Session或Cookie來存放輸入資料,再用JavaScript讀取
: 亦或是還有更好的辦法?
最簡單是用asp導回原本那頁就好,例如:
test.asp
<%
test_checkbox=request.form("test_checkbox")
test_radio=request.form("test_radio")
'如果要寫入資料庫之類可以加在下面:
'set conn=....
%>
<html>
<head>
<title>xxx</title>
</head>
<body>
<form action="test.asp" method="post">
<input name="test_checkbox" type="checkbox" <%if test_checkbox=true then
response.write "checked=""checked""%>>
<input name="test_radio" value="1" <%if test_radio=1 then
response.write "selected=""selected""%>>
<input name="test_radio" value="2" <%if test_radio=2 then
response.write "selected=""selected""%>>
<input type="submit" value="OK">
</form>
</body>
</html>
大約如此,改一下類似的就好,不然就是導回那頁時加入 ?xxx=xxx之類的變數控制,
方法很多,看你想用那一種。
用session也可以,有空再聊
--
歡迎參觀我的網站:
http://www.dcaid.com/
電腦/數位相機的介紹, 教學, 評測的網站, 慢慢成長中... ~ :)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.116.116