onemind Posted July 21, 2006 Share Posted July 21, 2006 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=ArrayHow do i pass an array properly?Thanks Link to comment https://forums.phpfreaks.com/topic/15237-how-do-you-sen-an-array-to-another-script/ Share on other sites More sharing options...
wildteen88 Posted July 21, 2006 Share Posted July 21, 2006 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. Link to comment https://forums.phpfreaks.com/topic/15237-how-do-you-sen-an-array-to-another-script/#findComment-61579 Share on other sites More sharing options...
boralyl Posted July 21, 2006 Share Posted July 21, 2006 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. Link to comment https://forums.phpfreaks.com/topic/15237-how-do-you-sen-an-array-to-another-script/#findComment-61591 Share on other sites More sharing options...
onemind Posted July 21, 2006 Author Share Posted July 21, 2006 Thanks guys,That works great :) Link to comment https://forums.phpfreaks.com/topic/15237-how-do-you-sen-an-array-to-another-script/#findComment-61596 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.