Nov 4, 2004 #1 milams Programmer May 28, 2004 32 US Is there a way to pass a PHP variable within a javascript script?
Nov 4, 2004 #2 cLFlaVA Programmer Jun 14, 2004 6,450 US That depends what you mean. You can echo the variable to the html/javascript, and then the JS function will run with that value. You'd just do something like: Code: echo '<script language="javascript">alert("$variable");</script>'; *cLFlaVA ---------------------------- Lois: "Peter, you're drunk!" Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking! Upvote 0 Downvote
That depends what you mean. You can echo the variable to the html/javascript, and then the JS function will run with that value. You'd just do something like: Code: echo '<script language="javascript">alert("$variable");</script>'; *cLFlaVA ---------------------------- Lois: "Peter, you're drunk!" Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!