Click here to Skip to main content
13,046,375 members (67,561 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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("Please assign the profile to new name before deleting");

var x=prompt("Enter here the new CIE name.","enter name");
if(x!=null && x!=" ")

if(x==null || del==false || x==" ")
alert("Sorry!You can not delete profile without assigning to the other CIE");
return false;
return false;
Posted 19-Feb-13 21:22pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

In your JS code (removed the extra space):
      if(x!=null && x!=" ") should be if(x!=null && x!="") 
      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 (which is a HTTP Request variable) or $_REQUEST["var"]. It should work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 25 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100