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> } Quote Link to comment 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 Quote Link to comment 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 } ?> 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.