Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将mysql记录ID从一个页面传递到另一个页面?_Php_Html_Mysql - Fatal编程技术网

Php 如何将mysql记录ID从一个页面传递到另一个页面?

Php 如何将mysql记录ID从一个页面传递到另一个页面?,php,html,mysql,Php,Html,Mysql,我有一个搜索表单,当您单击记录的“更多信息”链接时,将为该记录打开一个新窗口以显示其他信息,我使用** 和弹出窗口 <!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&g

我有一个搜索表单,当您单击记录的“更多信息”链接时,将为该记录打开一个新窗口以显示其他信息,我使用
**

和弹出窗口

<!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 content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Signature Pad</title>

<!-- The Signature Pad -->
<script type ="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript"  src="signature-pad.js"></script>
</head>
<body>
<center>
<fieldset style="width: 435px">
    <br/>
    <br/>
    <div id="signaturePad" style="border: 1px solid #ccc; height: 55px; width: 400px;"></div>
    <br/><br/><br/>
    <button id="clearSig" type="button">Clear Signature</button>&nbsp;
    <button id="saveSig" type="button">Save Signature</button>
    <div id="imgData"></div>
    <br/>
    </fieldset>
</center>
<div id="debug"></div>
</body>
</html>

签名本





清晰的签名 保存签名

要在PHP应用程序中携带变量,可以使用GET/POST(隐藏选项)或PHP会话,也可以使用数据库

由于您需要在web应用程序中保存变量,因此必须合并会话(使用或不使用数据库)

在每页顶部添加以下内容:
session_start()
这将允许您的web应用服务器跟踪每个用户

然后将任何变量分配给session
$\u session['user']='Bob'

然后,当您熟悉会话时,您可以只跟踪用户id,并将其余内容保存在数据库中


检查并从此处开始

这是您的“不工作”页面:

more_info.php

<p>I have some text here and am just a HTML page saved as .php</p>
<table class="auto-style16" style="width: 615px; height: 28px;">
<td style="width: 435px; height: 22px;" class="auto-style7">
**<a href="#" onclick="window.open('signature_pad.php?id=$rows[id]', 'newwindow', 'width=500,   height=200');    return false;"><input type="button" value="Get Signature" /></a>**
<?php
$myId = $_GET['id'];
?>
<p>I have some text here and am a HTML with PHP page saved as .php</p>
<table class="auto-style16" style="width: 615px; height: 28px;">
<td style="width: 435px; height: 22px;" class="auto-style7">
**<a href="#" onclick="window.open('signature_pad.php?id=<?php echo $myId; ?>', 'newwindow', 'width=500,   height=200');    return false;"><input type="button" value="Get Signature" /></a>**
我这里有一些文本,我只是一个保存为.php的HTML页面

****
应该是这样的:

more_info.php

<p>I have some text here and am just a HTML page saved as .php</p>
<table class="auto-style16" style="width: 615px; height: 28px;">
<td style="width: 435px; height: 22px;" class="auto-style7">
**<a href="#" onclick="window.open('signature_pad.php?id=$rows[id]', 'newwindow', 'width=500,   height=200');    return false;"><input type="button" value="Get Signature" /></a>**
<?php
$myId = $_GET['id'];
?>
<p>I have some text here and am a HTML with PHP page saved as .php</p>
<table class="auto-style16" style="width: 615px; height: 28px;">
<td style="width: 435px; height: 22px;" class="auto-style7">
**<a href="#" onclick="window.open('signature_pad.php?id=<?php echo $myId; ?>', 'newwindow', 'width=500,   height=200');    return false;"><input type="button" value="Get Signature" /></a>**

我这里有一些文本,是一个带有PHP的HTML页面,另存为.PHP

****
在上面的例子中,我使用php做了两件事,首先我收到了查询字符串id并将其保存到变量
$myId
中,然后我将变量打印到window.open的HTML位置。您也可以直接打印
$\u GET
,但我不希望这样做,以防需要对变量进行进一步的处理,如清理等


为什么不把id添加到
signature\u pag.php
中,就像你在
more\u info.php
中做的那样?@Prix我试过了,没用!到底是什么不适合你?它不能打开新窗口吗?查询不转到新窗口?你能说得更具体些吗?@Prix代码运行正常,我需要将记录id传递到弹出窗口。在第二页的按钮上使用弹出窗口不会将id传递给弹出窗口。@当按下按钮并出现弹出窗口时,这是地址栏签名_pad.php中的内容?id=$rows[id]那么我会在页面顶部执行类似操作吗$id=$_POST['id'];并添加隐藏字段?如果有许多变量,则可以在数据库中有一个表,并有以下字段:
userid
variables\u array
。然后将所有变量添加到
variables\u数组中
as
var\u name,var\u value;变量名称2,变量值等等,然后根据每个页面加载的数据库中的用户id(来自会话)解析这些变量。我对php Andrew相当陌生,所以你的解释有点让我费解。我有点了解你的建议。谢谢你的帮助!Andrew谢谢你的帮助,对于我想做的事情来说,这似乎太复杂了,所以我想我会把签名板移到主窗体中,直到我能弄明白为止。谢谢你的帮助!Prix更好的解释更有帮助我知道我需要在表单名称后添加一些东西,但我甚至没有想到将它放在php标记之间。非常感谢。这就是为什么我问你相关的代码,因为你说你没有,我相信问题是:)对不起,我的错,我实际上已经有$id=$\u GET[id];在页面的最顶端,我没有想到在页面扩展之后使用php标记。谢谢,它工作得很好。