ck1mark Posted April 11, 2006 Share Posted April 11, 2006 i am sending variables from flash 8 to php:$s_arr = $_POST['arr'];i can echo and get what i sent values: x100y100, x110y100but if i do a foreach it is empty, nothing happensforeach($s_arr as $coord){echo "executed";}what can i do? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 11, 2006 Share Posted April 11, 2006 Is $_POST['arr'] an array or is it a string?If you put the following line at the beginning of your script, what is displayed?[code]<?php echo '<pre>' . print_r($_POST,true) . '</pre>'; ?>[/code]Ken Quote Link to comment Share on other sites More sharing options...
ck1mark Posted April 11, 2006 Author Share Posted April 11, 2006 [!--quoteo(post=363544:date=Apr 10 2006, 11:19 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Apr 10 2006, 11:19 PM) [snapback]363544[/snapback][/div][div class=\'quotemain\'][!--quotec--]Is $_POST['arr'] an array or is it a string?If you put the following line at the beginning of your script, what is displayed?[code]<?php echo '<pre>' . print_r($_POST,true) . '</pre>'; ?>[/code]Ken[/quote]I dont know how to get a result for that in flash.I dont think i like php arrays!I send an array and when i echo $s_arr i get the whole array element1, element2, element3, ..xif i index it $s_arr[0] i get the first letter.. which in my first post was xso i assume it is handling my values as a string Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 11, 2006 Share Posted April 11, 2006 I don't use Flash, so I don't know how it is sending stuff back.It looks like you're getting a CSV string returned to your script. To turn it into an array, use the explode() function:[code]<?php $arr = explode(',',$s_arr); ?>[/code]Then you can use the array functions.Arrays in PHP are very powerful.Ken Quote Link to comment Share on other sites More sharing options...
ck1mark Posted April 11, 2006 Author Share Posted April 11, 2006 crown that mofo! Thanks much =] 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.