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

The Archive Base Latest Questions

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

I have a little issue with my coding. I am trying to create 2

  • 0

I have a little issue with my coding. I am trying to create 2 dropdown menus. One for displaying a list of buildings and then when user selects a building from the list, it will display the list of rooms in that building.

Problem is I have an error in my code. Below is the code:

      $sql="SELECT Building, Room FROM Room WHERE Building = '".$building."'";

      $sqlresult = mysql_query($sql);

      $sqldataArray = array();

      while($sqlrow = mysql_fetch_array($sqlresult))
   {
      $sqldataArray[$sqlrow['Building']]; 
      $sqldataArray[$sqlrow['Building']]['Rooms'][$sqlrow['Room']]; 
   }


       $buildingHTML = ""; 
       $buildingHTML .= '<select name="buildings" id="buildingssDrop">'.PHP_EOL;
       $buildingHTML .= '<option value="">Please Select</option>'.PHP_EOL; 

   foreach ($sqldataArray as $building => $buildingData) {      

            $buildingHTML .= "<option value='".$building"'>" . $building . "</option>".PHP_EOL;        

            }
            $buildingHTML .= '</select>';


       $roomHTML = ""; 
       $roomHTML .= '<select name="rooms" id="roomsDrop">'.PHP_EOL;
       $roomHTML .= '<option value="">Please Select</option>'.PHP_EOL;      
            foreach ($buildingData['Rooms'] as $roomId => $roomData) {        

            $roomHTML .= "<option value='".$roomId"'>" . $roomId . "</option>".PHP_EOL;        
  } 

            $roomHTML .= '</select>';

The error I am getting is this:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /web/stud/u0867587/Mobile_app/create_session.php on line 363

This is the line of code where the error is:

 $buildingHTML .= "<option value='".$building"'>" . $building . "</option>".PHP_EOL;  

Does anyone know how to fix this error and will this code I have written be able to perform what I said I want the dropdown menus to perform?

  • 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-28T14:19:00+00:00Added an answer on May 28, 2026 at 2:19 pm

    Change:

    $buildingHTML .= "<option value='".$building"'>" . $building . "</option>".PHP_EOL; 
    

    To:

    $buildingHTML .= "<option value='".$building."'>" . $building . "</option>".PHP_EOL; 
    

    and change:

    $roomHTML .= "<option value='".$roomId"'>" . $roomId . "</option>".PHP_EOL;
    

    To:

    $roomHTML .= "<option value='".$roomId."'>" . $roomId . "</option>".PHP_EOL;
    

    Using consistent spacing between the concatenation operations can help make these easier to spot in the future:

    $roomHTML .= "<option value='" . $roomId . "'>" . $roomId . "</option>" . PHP_EOL;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a table and i have little issue with groupby month CREATE TABLE
I have a little issue right now and its bugging me, hopefully one of
I'm running in a little issue here regarding jsf related dropdown selection. I have
I have a little issue w/ an element displaying in IE9 the structure: <div
I have a little issue concerning an animation-effect which loads a certain div into
Hey guys I have a little issue here. I have a panel where I
I have little question about how web browser retrieve webpage? I know this User
I have a strange little issue with a WCF RIA service I'm using in
This little issue is starting to do my head in, I have read around
So, I've been coding for a little (2 years), and I have a very

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.