2013-03-15 148 views
-1

我有一个脚本,在客户网页上我有将数据发送到java.js页然后将其发送到另一个页面

<a href='hueimx.php?action=edit&uid={$result['uid']}'>click to edit</a> 

{$result['uid']} 

这是一个客户ID,我从数据库中获得。

现在我想在我的javascript页面上收到“uid”值。这是我的代码:

function insert() { 
// Optional: Show a waiting message in the layer with ID login_response 
document.getElementById('huemix_message').innerHTML = "<img src='images/saver.gif' />" 
// Required: verify that all fileds is not empty. Use encodeURI() to solve some issues about character encoding. 
var system_name= encodeURI(document.getElementById('system_name').value); 
var system_logo = encodeURI(document.getElementById('system_logo').value); 
var system_number = encodeURI(document.getElementById('system_number').value); 
var system_tel = encodeURI(document.getElementById('system_tel').value); 
if($("#system_pics").is(':checked')){ 
     var system_pics = 1; 
    } else { 
     var system_pics = 0; 
    } 
if($("#system_bread").is(':checked')){ 
     var system_bread = 1; 
    } else { 
     var system_bread = 0; 
    } 

// Set te random number to add to URL request 
nocache = Math.random(); 
// Pass the login variables like URL variable 
http.open('get', 'huemixpanel_insert.php?system_name='+system_name+'&system_logo='+system_logo+'&system_number='+system_number+'&system_tel='+system_tel+'&system_pics='+system_pics+'&system_bread='+system_bread+'&uid='+uid+'&nocache = '+nocache); 
http.onreadystatechange = insertReply; 
http.send(null); 
} 

在此页面中我收到从设置页面中的所有值,并将其转发到PHP页面将它们插入到数据库中。一切工作正常,但我不知道如何接收“uid”值并按照您所看到的发送它。

+0

不知道如果我完全理解,但如果你只是想跟踪值(如用户ID )在服务器上使用会话变量不是更容易吗? – 2013-03-15 22:12:28

+1

为了在这里得到有用的答案,你必须在你在这里问的问题上付出一些努力。 1.)你在尝试什么? 2.)你期望什么。 3.)而是发生了什么。我们都是volteers,所以帮助我们来帮助你。 – 2013-03-15 22:33:05

回答

0

那么,如果你唯一的目标是将数据从一个页面发送到另一个页面。然后,您可以通过在URL中附加数据轻松完成此操作。而在另一页上,只需获取数据并处理您的操作。

您的脚本非常适合发送数据。在其他网页“* huemixpanel_insert.php *”请你考虑加入这行代码:

<?php 
if(!empty($_GET['uid'])) 
{ 
    $uid = strip_tags($_GET['uid']); // check for security hole 
    //Your rest of the ***huemixpanel_insert.php*** code goes down here... 
} else { 
    //You can die the rest of the page if uid is not received. (Optional) don't use else if you don't want to take any action. 
} 
?> 
+0

好看 我有一个设置页面为我的脚本..

2013-03-16 15:11:22

+0

@ user2175697看看上面的解决方案..并告诉我,如果你仍然有问题。 – 2013-03-16 19:09:29

相关问题