Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 371543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:07:28+00:00 2026-05-12T14:07:28+00:00

I have a form which sends lots of GET[‘var’] in a form. Ive worked

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:07:28+00:00Added an answer on May 12, 2026 at 2:07 pm

    The php implode function will concatenate the contents of an array together, using a string to insert between them, like so:

    $var = implode(',', $_GET['var']);
    

    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:

    $var = $_GET['var'];
    ksort($var);
    $joinedString = implode(',', $var);
    

    Edit: According to the question edit:

    Assuming you mean to create the query string again…?

    $var = $_GET['var'];
    $components = array();
    
    foreach($var as $key=>$value) {
    
      $components[] = "var[" . $key . "]=" . $value;
    
    }
    
    $string = implode('&', $components);
    

    Might help to have a more detailed description.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple form at my site which sends it data via Ajax
i have an form which will send some data to an php file ,
I have a form which has a single textbox that sends some data to
I have a button that has custom code which sends the form data to
I have a form on my site which sends data to some remote site
I have a form which sends data with the POST method, about 3000 array
I have a form which sends form data for processing and accordingly receive the
I have a form which sends data to a text file, but I'm trying
I have a form which sends data to a proccess page. Is it possible
I have a form, which sends data through a Jquery Ajax Call over to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.