drvpv7995 2013-05-16 07:55 采纳率: 100%
浏览 16

两个人不断互相改变

I'm trying to update a database from two id's. One arrives with an other page. And one gets send by an element on the page. The problem is that both are send by GET so they keep changing each other. Is there anyway to fix this?

<?php
$id1 = $_REQUEST["id"];
echo $id1;
if($_GET["Action"] == "Wijzig")  
{  
    include 'Includes/database_connection.php';
    $strSQL = "UPDATE pairings SET sim_id='".$_GET["id"]."'";  
    $strSQL .="WHERE unit_id = '".$id1."' ";  
    $objQuery = mysql_query($strSQL);  
}

\\Action on current page
    <li><a href="JavaScript:if(confirm('Heeft u de goede geselecteerd?')==true){window.location='<?=$_SERVER["PHP_SELF"];?>?Action=Wijzig&id=<?=$row["id"];?>';}"><?php echo $row['phonenr'];?></a></li>
\\Action on previous page
<a href="#" onclick="window.open('test.php?id=<?php echo $row['id']; ?>', 'newwindow', 'width=5000, height=5000'); return false;" ><img src="images/arrowUpDown.png"/></a>
  • 写回答

1条回答 默认 最新

  • dongquan0024 2013-05-16 08:34
    关注

    Try this to avoid the GET and make it a POST:

    • put a hidden form on the page named actionform containing hidden type form fields "Action" and "id".
    • <li><a href="#" onclick="if(confirm('Heeft u de goede geselecteerd?')){document.forms.actionform.elements['id'].value='<?php echo $row['id'];?>';} return false;"><?php echo $row['phonenr'];?></a></li>

    This should put the id in the form, submit the form, and return false to indicate that the default action of the a is not to be executed.

    Regarding your duplication problem, explain it better, but maybe the return false helps.

    评论

报告相同问题?

悬赏问题

  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗