I have a form which sends lots of GET[‘var’] in a form.
Ive worked out how to set it to send var[1]=data&var[2]=some&var[3]=thing etc etc
but how do I catch each variable and combine it into one string, seperated with a “, “?
so $var = data, some, thing
UPDATE:
Sorry I should of mentioned I already have the function that implodes the string but I dont know how to combine all the Var[n]’s into one $var string.
Hope this makes sense!
Solved!
Thanks Kazar, your first answer actually worked a treat! it required me altering my script a little but your way certainly makes sense to me now
The php implode function will concatenate the contents of an array together, using a string to insert between them, like so:
An additional note, the order in which the various elements of var appear does depend on the order in the querystring, so a string could come out looking like ‘var2,var0,var1’. To get round this, you may want to do a key sort first:
Edit: According to the question edit:
Assuming you mean to create the query string again…?
Might help to have a more detailed description.