The14thGOD Posted March 24, 2007 Share Posted March 24, 2007 Hey, I was wondering, how would you go about getting an array form the URL? can you just post it like this "domain.com/index.php?array=1,2,3,4 and then use: <?php $array = $_GET['array']; and then the array would read as: $array[0] == 1 $array[1] == 2 etc... thanks in advance Link to comment https://forums.phpfreaks.com/topic/44092-retrieve-arrays-from-url/ Share on other sites More sharing options...
DanDaBeginner Posted March 24, 2007 Share Posted March 24, 2007 im not sure..im sure this will work.... url: ?var[]=hello&var[]=hi&var[]=howru prin_r($_GET[var]); Link to comment https://forums.phpfreaks.com/topic/44092-retrieve-arrays-from-url/#findComment-214087 Share on other sites More sharing options...
Orio Posted March 24, 2007 Share Posted March 24, 2007 <?php //The requested page is "domain.com/index.php?array=1,2,3,4" $array = explode(",", $_GET['array']); print_r($array); ?> Orio. Link to comment https://forums.phpfreaks.com/topic/44092-retrieve-arrays-from-url/#findComment-214124 Share on other sites More sharing options...
DanDaBeginner Posted March 24, 2007 Share Posted March 24, 2007 good idea orio, why didn't I think of that... I forgot the power of explode... Link to comment https://forums.phpfreaks.com/topic/44092-retrieve-arrays-from-url/#findComment-214127 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.