dsjhejw3232 2013-06-11 01:51
浏览 16
已采纳

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

I have a search form that when you click on the more info link for a record will open a new window for that record to display additional information and I use <a href=more_info.php?id=$rows[id]>to pass the id to the next page and that works great.

On that next page I have a button that pops up a small browser window using this <a href="#" onclick="window.open('signature_pad.html', 'newwindow', 'width=500, height=200'); return false;"> this windows pops up with a signature pad.

What I need to do is pass that record ID from the second window to the popup window so when the customer signs the signature pad their signature is posted into the correct record.

so here is the code for the 2nd and popup pages: (I only posted the code for the button section of the 2nd page to save space as the code for that page is fairly long and only the button portion pertains to this question)

<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', 'newwindow', 'width=500,   height=200');    return false;"><input type="button" value="Get Signature" /></a>**

And the popup window

<!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>
  • 写回答

2条回答 默认 最新

  • doubeng3216 2013-06-11 04:26
    关注

    This is the doesn't work page you have:

    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>**
    

    This is how it should be:

    more_info.php

    <?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>**
    

    On my above example, I am making use of php for 2 things, first I received the query string id and save it into my variable $myId then I print the variable to the HTML location it should for the window.open. You can also print the $_GET directly but I prefer not to in case I need to further do things to the variable like sanitization, etc.

    More information on $_GET

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程