Jump to content

PHP get multiple values


Mudsaf

Recommended Posts

no, a query string is just that, a string. If you have a delimited list as a value, as in the case for var, you would need to explode the string first.

http://php.net/manual/en/function.explode.php

<?php $vars = explode('&', $_GET['var']); echo $vars[0];  //1echo $vars[1];  //2echo $vars[2];  //3?>
Edited by thescientist
Link to comment
Share on other sites

Note that & has a special meaning in the URL, it separates key/value pairs. If that's the character you want to use as a separator then you need to encode it. Otherwise, that will create $_GET['var'], and set it to 0, $_GET['1'] and it will be empty, and $_GET['2'] and it will be empty.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...