Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass multiple values for a single URL parameter?

Is it possible to pass multiple values for a single URL parameter without using your own separator?

What I want to do is that the backend expects an input parameter urls to have one or more values. It can me set to a single or multiple URLs. What is a way to set the urls parameter so it can have multiple values? I can't use my own separator because it can be part of the value itself.

Example: http://example.com/?urls=[value,value2...]

The urls parameter be set to just http://google.com or it can be set to http://google.com http://yahoo.com .... In the backend, I want to process each url as a separate values.

like image 807
Cory Avatar asked Nov 07 '12 00:11

Cory


People also ask

How do I pass multiple values in a URL?

Any word after the question mark (?) in a URL is considered to be a parameter which can hold values. The value for the corresponding parameter is given after the symbol "equals" (=). Multiple parameters can be passed through the URL by separating them with multiple "&".

How do I pass multiple values in a single parameter in SQL query?

My logic to solve this problem: Pack the values into one string with comma separated. Set the string as parameter and pass it into the SQL statement. Unpack the values and insert the values into a table, Where customerid in (select id from #temp)


1 Answers

http://.../?urls=foo&urls=bar&...

...

request.GET.getlist('urls')
like image 134
Ignacio Vazquez-Abrams Avatar answered Oct 10 '22 10:10

Ignacio Vazquez-Abrams