LOSTBOY Posted November 22, 2007 Share Posted November 22, 2007 hi experts am an php beginner ...i need to know is there is any option for passing array through url ............... plz clear my doubt with some example thanks in advance Quote Link to comment Share on other sites More sharing options...
trq Posted November 22, 2007 Share Posted November 22, 2007 No. You'll need to turn it into a string. Quote Link to comment Share on other sites More sharing options...
snk Posted November 22, 2007 Share Posted November 22, 2007 you turn your array into a string with seperator character of your choice, lets say - you pass it to the other page with post or get you make the string array again with explode() for example $arrayAgain = explode("-",$stringFromPostorGet); so. if you want to print an element you say echo $arrayAgain[0]; to print the first value.. Quote Link to comment Share on other sites More sharing options...
redarrow Posted November 22, 2007 Share Posted November 22, 2007 sorry had to go it my birthday i will continue soon.. <?php // this is a simple array the array starts from 0 not 1 so one is at 0 and two at one....... $my_array1=array("one","two","three"); // to walk throm a array you use the function foreach...... foreach($my_array1 as $value){ echo "<br>$value<br>"; } //This will show all what in the array one two three // also to see the postion of the array's order you use foreach with key added agin like so....... $my_array2=array("one","two","three"); foreach($my_array2 as $key => $val){ echo " <br>$key $val <br>"; } //This will show all what in the array 0 one 1 two 3 three //also now let use another method to get the array values using implode function.. $my_array3=array("one","two","three"); $val=implode(' ',$my_array3); echo $val; // the result is one two three ?> Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 22, 2007 Share Posted November 22, 2007 Another way to do this is to use the serialize() and unserialize() functions. Use serialize() to make the array into a string, unserialize() to reconstitute the array. Ken 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.