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 9122725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:10:13+00:00 2026-06-17T06:10:13+00:00

I used contact in php like this $location_space = ”; $location_formation = ”; foreach($location

  • 0

I used contact in php like this

$location_space     = '';
$location_formation = '';

foreach($location as $formation) {
    $location_formation .= $formation.', ';
    $location_space     .= $formation.'<br />';
}

When I wanted to change it into javascript:

var location_space      = '';
var location_formation  = '';

for (i = 0; i < new_location.length; i++) {
    var location_space      += new_location[i] + ', ';
    var location_formation  += new_location[i] + '<br />';
}

It showed me this error

Error: SyntaxError: missing ; before statement
Line: 311, Column: 32
Source Code: var location_space += new_location[i] + ‘, ‘;

So what is wrong?

  • 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-06-17T06:10:15+00:00Added an answer on June 17, 2026 at 6:10 am

    You have already defined location_space and location_formation, so you only need to assign a value to them, not redeclare them inside the for() loop:

    var location_space      = '';
    var location_formation  = '';
    
    for (var i = 0; i < new_location.length; i++) 
    {
        location_space      += new_location[i] + ', ';
        location_formation  += new_location[i] + '<br />';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I've previously used this very simple php contact script with success though when
I need to pick contact phone num, and I used to do it like
<a href=tags.php onclick=return popitup('tags.php')>tags</a> I have this line of code that runs the javascript
I have this .htaccess that I've been using to rewrite URLs like these: www.example.com/index.php?page=brand
I have a form in contact.php with a considerable amount of inputs. this form
Hi I'm trying to add some another field to this php contact form I
I have very limited knowledge of PHP so I used a contact form generator,
Considering that my experience with PHP is limited, I used a contact form generator
If you visit this page in Chrome: http://www.immigrationconsult.org/contact.php And Inspect Element on the page,
I have an index.php and a contact.php . index.php uses load() like so: $(#content).load(contact.php);

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.