将提示框变量从javascript传递给php [英] Pass prompt box variable from javascript to php

查看:70
本文介绍了将提示框变量从javascript传递给php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我有问题将javascript提示框的变量传递给php脚本。任何人都可以在我的下一个脚本中找到我所犯的错误..谢谢

Hello I am having problem to pass the variable of javascript prompt box to php script . can any one find which mistake I have done in my following script .. Thank you




function confirmDelete()

{

var del = confirm(请在删除之前将配置文件分配给新名称);

if (del == true)

{



var x = prompt(在这里输入新的CIE名称。,输入名称) );

if(x!= null&& x!=)

{

window.location.href = delete.php?var =+ x;

}



if(x == null || del == false || x ==)

{

alert(抱歉!你无法在不指定其他CIE的情况下删除个人资料);

返回false;

}

}

else

{

返回false;

}

}


function confirmDelete()
{
var del = confirm("Please assign the profile to new name before deleting");
if(del==true)
{

var x=prompt("Enter here the new CIE name.","enter name");
if(x!=null && x!=" ")
{
window.location.href="delete.php?var="+x;
}

if(x==null || del==false || x==" ")
{
alert("Sorry!You can not delete profile without assigning to the other CIE");
return false;
}
}
else
{
return false;
}
}

推荐答案

In your JS code (removed the extra space):

      if(x!=null && x!=" ") should be if(x!=null && x!="") 
  and  
      if(x==null || del==false || x==" ") should be if(x==null || del==false || x=="")

It seems alright, but i'm confused why you couldn't get the variable in your PHP script. Try to print/check 


_REQUEST (这是一个HTTP请求变量)或
_REQUEST (which is a HTTP Request variable) or


_REQUEST [var] 。它应该可以工作。
_REQUEST["var"]. It should work.


这篇关于将提示框变量从javascript传递给php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆