thangappan Posted January 30, 2009 Share Posted January 30, 2009 Is there any way to send array (both types) values to another page using GET method. For an example. $table_name = contacts; $attributes = array("First_name" => "first_name"); echo "<script language=\"javascript\" > window.location=\"Pagination.php?Value=$table_name:$attributes;\"; </script> While doing the above code, $table_name passed correctly as contacts.But $attributes passed as string `Array`. Could you please solve my problem. Link to comment https://forums.phpfreaks.com/topic/143075-sending-values-to-another-page/ Share on other sites More sharing options...
genericnumber1 Posted January 30, 2009 Share Posted January 30, 2009 The simplest (and most secure) way would just be to implode() it and later explode() it or use http_build_query().. serialize()ing it would probably be a bad idea. Link to comment https://forums.phpfreaks.com/topic/143075-sending-values-to-another-page/#findComment-750374 Share on other sites More sharing options...
thangappan Posted January 30, 2009 Author Share Posted January 30, 2009 I need to retain the value after sending to another page.Is there any way in php. For an example, http_build_query($data) It returns string as val=contacts&attr=head&first_name=thanga I want to retain all the values into an array. Could you please solve my problem with correct explanation. Link to comment https://forums.phpfreaks.com/topic/143075-sending-values-to-another-page/#findComment-750571 Share on other sites More sharing options...
genericnumber1 Posted January 30, 2009 Share Posted January 30, 2009 page1.php: <?php $data = array("First_name" => "first_name"); echo '<a href="page2.php?' . http_build_query(array('data' => $data)) . '">Next page</a>'; page2.php: <?php echo '<pre>' . print_r($_GET['data']) . '</pre>'; Or, so you don't have to constantly worry about the validity of the data, just use sessions. Link to comment https://forums.phpfreaks.com/topic/143075-sending-values-to-another-page/#findComment-750942 Share on other sites More sharing options...
thangappan Posted January 31, 2009 Author Share Posted January 31, 2009 My problem has been solved.Thanks for your posting a excellent information. Link to comment https://forums.phpfreaks.com/topic/143075-sending-values-to-another-page/#findComment-751136 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.