Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing variables

Status
Not open for further replies.

milams

Programmer
May 28, 2004
32
US
Is there a way to pass a PHP variable within a javascript script?
 
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!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top