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. Link to comment https://forums.phpfreaks.com/topic/30451-pass-variabe-from-php-to-java-script/ 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"] Link to comment https://forums.phpfreaks.com/topic/30451-pass-variabe-from-php-to-java-script/#findComment-140270 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... Link to comment https://forums.phpfreaks.com/topic/30451-pass-variabe-from-php-to-java-script/#findComment-140730 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.