Suchy Posted February 7, 2008 Share Posted February 7, 2008 I am having troubles passing a varioabl from javascript into php, what is the correct way to do this? <script type="text/javascript"> ... var i=0; for (i=0 ; i < <?php echo count($contact) ?> ; i++) { contact_status[i]= "<?php print_r( $contact[ ?>" + i + "<?php ]['number']); ?>" ... </script> } Link to comment https://forums.phpfreaks.com/topic/89945-js-var-php/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 7, 2008 Share Posted February 7, 2008 See this link for passing data from javascript in the browser to php on the server - http://w3schools.com/php/php_ajax_intro.asp Link to comment https://forums.phpfreaks.com/topic/89945-js-var-php/#findComment-461124 Share on other sites More sharing options...
Suchy Posted February 7, 2008 Author Share Posted February 7, 2008 Got it, I did something simpler: <?php for ($i = 0 ; $i < count ($contact) ; $i++){ ?> contact_status[ <?php echo $i ?> ] = " <?php print_r( $contact[$i]['number']); ?> " <?php } ?> Link to comment https://forums.phpfreaks.com/topic/89945-js-var-php/#findComment-461250 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.