Jump to content

[ARRAYS] Passing array as URL parameter


flaab

Recommended Posts

Hello 2all =)

 

I'll go straigh to the point. I'm programming a little search engine for my site.

The search function returns an array with the ID's of the databases retrievals for the users criteria.

 

Example: $retrievals = array(2,56,57,190,257,346,...,whatever);

 

And i want to split the results to view only 20 per page.

 

So, i need to pass that array as a parameter for an url.

 

Example: <a href="whatever.php?retrievals=<?php print $retrievals; ?>

 

And let the array be received by another document.

 

How can i do that?

 

Is there a better way to do this?

 

Thanks a lot.

Link to comment
Share on other sites

A better approach what I think would br serialize it and then unserialize it on next paga

 

$strRetrievals = serialize($retrievals);

 

<a href="whatever.php?retrievals=<?php print $strRetrievals; ?>

 

and on next page you can use

 

$strRetrievals = $_GET['retrievals'];

$arrRetrievals = unserialize($strRetrievals);

 

hope you find it useful for future use.....  ;)

 

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.