BluesMan
11-26-2005, 09:11 AM
I want to populate an array from either the url or a form. Something like this:
user enters url: index.php?numbers=1,2,3,4,5,6
In index.php I have
$numbers = $_GET['numbers'];
$test = array($numbers);
I want that to become
$test = array(1,2,3,4,5,6);
My code doesn't work - $numbers is an 11 charakter string.
$numbers becomes $numbers = "1,2,3,4,5,6"
Is there any (preferrably simple) way to do this?
What I want in the end, is to get the numbers into an array and compare them with another array. I've got that part of the code working, but can't populate the $numbers properly.
It doesn't matter whether the values are integers or strings, as long as I get 6 of them and not only one as I do now.
user enters url: index.php?numbers=1,2,3,4,5,6
In index.php I have
$numbers = $_GET['numbers'];
$test = array($numbers);
I want that to become
$test = array(1,2,3,4,5,6);
My code doesn't work - $numbers is an 11 charakter string.
$numbers becomes $numbers = "1,2,3,4,5,6"
Is there any (preferrably simple) way to do this?
What I want in the end, is to get the numbers into an array and compare them with another array. I've got that part of the code working, but can't populate the $numbers properly.
It doesn't matter whether the values are integers or strings, as long as I get 6 of them and not only one as I do now.