ecopetition Posted August 13, 2009 Share Posted August 13, 2009 Hi, Is it possible to collect an array from form data in one page then forward that array to another page (using header('Location: xx') for use there? Hope that makes sense! Quote Link to comment https://forums.phpfreaks.com/topic/170128-array-forwarding/ Share on other sites More sharing options...
jake2891 Posted August 13, 2009 Share Posted August 13, 2009 not sure if i fully understand. but if you want to pass an array via the url you can serialize the array. ? <a href="test.php?arr=<?php echo serialize($array); ?>">test</a> then on test.php <?php $array = unserialize($_GET["array"]); ?> Quote Link to comment https://forums.phpfreaks.com/topic/170128-array-forwarding/#findComment-897429 Share on other sites More sharing options...
ecopetition Posted August 13, 2009 Author Share Posted August 13, 2009 Ok thanks, but how secure is this method? Quote Link to comment https://forums.phpfreaks.com/topic/170128-array-forwarding/#findComment-897441 Share on other sites More sharing options...
hostingon Posted August 13, 2009 Share Posted August 13, 2009 One method to not show your data in get parameters is to post this array data only with post methods to another page. <fom method=post ...> Another method is to use Sessions to save data in. and then you can access them from $_SESSION array. <?php session_start(); $_SESSION['favcolor'] = 'green'; $_SESSION['animal'] = 'cat'; ?> and then in other page you can get variables with: $favcolor=$_SESSION['favcolor'] ..... Third method is to use mysql table to store this array thata only temporary - and to use unique id from mysql_insert_id() with wich you can get again this post variables from second page. Quote Link to comment https://forums.phpfreaks.com/topic/170128-array-forwarding/#findComment-897579 Share on other sites More sharing options...
mikesta707 Posted August 13, 2009 Share Posted August 13, 2009 serializing the array is probably a bad idea, especially if you are putting it in the URL, as anyone can simply alter the data in the variable. I would use either the post method, or the sessions method. Quote Link to comment https://forums.phpfreaks.com/topic/170128-array-forwarding/#findComment-897581 Share on other sites More sharing options...
Psycho Posted August 13, 2009 Share Posted August 13, 2009 serializing the array is probably a bad idea, especially if you are putting it in the URL, as anyone can simply alter the data in the variable. I would use either the post method, or the sessions method. Um, GET data is no more/less secure than POST data. A user can modify POST data just as easily than GET data. If you are not validating/cleansing ALL user data (GET, POST & COOKIE) you are not secure. Quote Link to comment https://forums.phpfreaks.com/topic/170128-array-forwarding/#findComment-897587 Share on other sites More sharing options...
mikesta707 Posted August 13, 2009 Share Posted August 13, 2009 serializing the array is probably a bad idea, especially if you are putting it in the URL, as anyone can simply alter the data in the variable. I would use either the post method, or the sessions method. Um, GET data is no more/less secure than POST data. A user can modify POST data just as easily than GET data. If you are not validating/cleansing ALL user data (GET, POST & COOKIE) you are not secure. yes true, but modifying GET data is, for lack of a better word, easier for the end user in my opinion. since it is right there on the URL line, most anyone can figure out how to change the data in a few seconds. then again, if he validates the data it doesn't really matter in the end anyways. Quote Link to comment https://forums.phpfreaks.com/topic/170128-array-forwarding/#findComment-897593 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.