Jump to content

Passing array Through URL!!!!!!!!


LOSTBOY

Recommended Posts

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..

Link to comment
Share on other sites

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


?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.