我试图通过cfm页面传递唯一的数据库会话ID,但似乎无法使其工作。页面1具有记录ID,我正在尝试在recordclick()函数中保存numSession,并将其传递到下一页,在那里我在我的查询中使用它,但它不起作用。
以下是我正在进行的大致概述:
页面1:
<CFQUERY datasource = "database1" result = "result">
insert into user
set
blah blah
</cfquery>
<html>
<head>
<title>page1</title>
<script type="text/javascript">
function recordClick(imageid)
{
document.getElementById("numSend").value = document.getElementById("numSend").value + imageid;
document.getElementById("numSession").value = result.generated_key;
}
</script>
</head>
<body>
<FORM action="page2.cfm" method="post">
<img src="1.png" NAME="num1" onclick="recordClick(1)"
width="100px"
height="100px">
<div name="num1" id="num1"></div>
<input type="hidden" id="numSend" name="numSend" />
<input type ="hidden" id = "numSession" name ="numSession" />
<input type="submit" value="Done" />
</form>
</body>
</html>
--------------------------------------
<cfoutput>
The ID of the row I just inserted was "#numSession#"
</cfoutput>
<CFQUERY datasource = "database1">
update user
set
pin = "#numSend#"
where id= "#numSession#"
</cfquery>
<cfoutput>
标记。这是否解决了您的问题? - James Hill...where id= "#FORM.numSession#"
。 - James Hill