austine_power007 Posted December 13, 2006 Share Posted December 13, 2006 How can i pass variable from PHP to Java Script??I have a output in text field and the name is "comp" so i created a variable in php named $i ....and i want this "comp" text field as a array ........how?? so that i can check what user input is wrong or right. Quote Link to comment Share on other sites More sharing options...
artacus Posted December 13, 2006 Share Posted December 13, 2006 [code]<script language="javascript">var comp = '<?=$php_var ?>';[/code]A php array will have to be converted to the javascript syntax ["abc",1,"stuff"] Quote Link to comment Share on other sites More sharing options...
fenway Posted December 13, 2006 Share Posted December 13, 2006 And should be able to easy write a PHP to do just that... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.