Jump to content

Archived

This topic is now archived and is closed to further replies.

onemind

How do you sen an array to another script?

Recommended Posts

Hi,

I have a header like so: header("Location: errors.php?err=$errors"); 

Where $errors is an array.

When i run this it goes to a site with this address: /errors.php?err=Array

How do i pass an array properly?

Thanks

Share this post


Link to post
Share on other sites
serialize it:
$errors = serialize($errors);

then when you retrieve the errors unserialize, them:
$errors = unserialize($_GET['errors']);

However Id suggest you use a cookie/sessions instead rather then sending the errors through the url.

Share this post


Link to post
Share on other sites
Any pages you use $_SESSION start it off with session_start().  Then you can use variables across scripts.  So on script 1 you can store the array in say $_SESSION['errors'] = $errors;  Then on script 2 you can recall it simply by using the $_SESSION['errors'] variable.

Share this post


Link to post
Share on other sites

×

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.