Hello all,
I have a question
I have 2 ids in a url that I want to extract with php, but it doesn't work, can someone help me below an example
this is the url:
$string=$_GET['id'];
list($first,$second)=explode('&',$string);Hello all,
I have a question
I have 2 ids in a url that I want to extract with php, but it doesn't work, can someone help me below an example
this is the url:
$string=$_GET['id'];
list($first,$second)=explode('&',$string);Did the code you provided not work? I haven't tested it, but it should give you the two numbers in the variables $first and $second.
I think a problem you might be running into is that the & character has a special meaning in URL query strings. For example, a query string might look like ?id=5&name=dani It's possible that $string is only retrieving the first number up until the ampersand.
Can you use a different delimiter in your query string instead? For example artist.php?id=1,2,3
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.