Pass arrays from page a to b
Posted: Tue Jun 06, 2006 3:35 am
I wander if I can pass arrays from page a to page b with the a tag (without the use of forms).
Thanks.
Thanks.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
page a:Code: Select all
while (($file2 = readdir($open_folder)) !== false)
{
if ($file2 != "." AND $file2 != ".." AND $file2 != "Thumbs.db")
{
if ($_POST['change'.$file_id] == "on")
{
$to_used[$file_to] = $file2;
$file_to++;
}
$file_id++;
}
}
closedir($open_folder);
$to_used = serialize($to_used);
<a href="<?php echo $url."&fileto=".$file_to."&to_used=".$to_used; ?>" target="index">Bip Bip !!!</a>Code: Select all
$file_id = 0;
$to_used = unserialize($to_used);
while ($file_id < $fileto)
{
echo $to_used[$file_id];
$file_id++;
}Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]Code: Select all
<a href="?foo[]=42&foo[]=10&foo[]=12">Click me</a>
<?php
if (isset($_GET['foo']))
{
print_r($_GET['foo']; //array( 42, 10, 12 )
}
?>Code: Select all
$to_used = serialize($to_used);
<a href="<?php echo $url."&fileto=".$file_to."&to_used=".$to_used; ?>" target="index">Bip Bip !!!</a>Code: Select all
$file_id = 0;
$to_used = unserialize($to_used);Code: Select all
$to_used = urlencode(serialize($to_used));
<a href="<?php echo $url."&fileto=".$file_to."&to_used=".$to_used; ?>" target="index">Bip Bip !!!</a>Code: Select all
$file_id = 0;
$to_used = urldecode(unserialize($to_used));