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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:06:30+00:00 2026-06-12T18:06:30+00:00

Can some one tell me why the following doesn’t populate the dropdown with the

  • 0

Can some one tell me why the following doesn’t populate the dropdown with the the values from the dist_itnry column of my database?

<?php 
$distUsr = $_SESSION['Distributor_user'];
$con=mysql_connect('localhost','root') or die ("Server connection failure!");
$db=mysql_select_db('regional_data',$con) or die ("Couldn't connect the database");
$SQL1="SELECT dist_itnry, route FROM sr_itinerary";
$run1=mysql_query($SQL1,$con) or die ("SQL Error");
$nor1=mysql_num_rows($run1);

while($rec=mysql_fetch_array($run1))
{
    while ($rec = $distUsr)
    {
        echo "<option id='options'>$rec<br></option>";
    }
}
?>
  • 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-12T18:06:31+00:00Added an answer on June 12, 2026 at 6:06 pm

    You were overwriting $rec. Also, please take a look at the other changes I made like including the <select> tag and a more proper usage of the <option> tag. You can specify a different value for the <option> tag. Example: <option value="123">Something</option> – this means “123” will be the value submitted when the form is submitted. But “Something” will be displayed in the form.

    The corrected code is listed below:

    <?php 
    $distUsr = $_SESSION['Distributor_user'];
    $con=mysql_connect('localhost','root') or die ("Server connection failure!");
    $db=mysql_select_db('regional_data',$con) or die ("Couldn't connect the database");
    $SQL1="SELECT dist_itnry, route FROM sr_itinerary";
    $run1=mysql_query($SQL1,$con) or die ("SQL Error");
    $nor1=mysql_num_rows($run1);
    echo '<select name="dropdown">';
    while($rec=mysql_fetch_array($run1))
    {
        $value = $rec['dist_itnry'];
        echo "<option value=\"$value\">$value</option>";
    }
    echo '</select>';
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can some one tell me how do i display real time in c++. what
Can some one please tell me why exactly classes were introduced in C++. Are
Please can some one briefly tell me with example what does the means of
Can someone tell me please why the following example work in Firefox but not
Can someone tell me how I can make the following output? I have a
Can someone please tell me how I can implement the following line of pseudo-code.
can someone tell me what seems to be the issue with this <?php $increment
Can someone tell me how can I select the Row under the one on
I'm going through some Zend PHP certification questions and am stuck on this one:
I have the following setup: class.staff.php This defines many variables, the one I'm working

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.