5

Is there a method to create URL from different parameters?

For example, from:

id=1
option=view
task=delete

to:

index.php?id=1&option=view&task=delete

1 Answer 1

3

You can use php method http_build_query to generate url encoded query string.

Club all the different parameters in an array and pass it to this method.

Like

$base_url = 'index.php?';
$parameter = array('id'=>'1',
              'option'=>'view',
              'task'=>'delete');

$base_url .= http_build_query($parameter);
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.