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

  • Home
  • SEARCH
  • 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 7810669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:52:06+00:00 2026-06-02T03:52:06+00:00

I have a web page where you can add new users onto the system.

  • 0

I have a web page where you can add new users onto the system. One of the values that gets added to the database is an account type value which selected from a PHP drop down menu with values from a MySQL database. The problem that I am having is that when I try to add a record from the dropdown menu the value is always ‘undefined’, where as it should be the value that is selected (e.g. If Account Type ‘Test’ is selected, ‘Test’ should be the value inserted into the database)

Here is my code if anybody can help me with this problem:

mysql_connect('localhost', 'username', 'password');

mysql_select_db('databasename');

$sql="SELECT Id, AccountName FROM tblaccounts";
$result=mysql_query($sql);

$options="";

while ($row=mysql_fetch_array($result)) {

    $id=$row["Id"];
    $accname=$row["AccountName"];
    $options.="<OPTION VALUE=\"$id\">".$accname.'</option>';

}

Displaying the dropdown:

<div class="cp-controls-lrg left">

    <p class="controls-margin">Account</p>

        <select name="sel-account-name" id="sel-account-name" class="cp-controls-sml input-select input-select-xxlrg" tabindex="6">

        <option value="0">Select Account
             <?php echo $options?>

        </select>

 </div>

Let me know if you need any additional code to find out what the problem is, Many thanks!!

  • 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-02T03:52:09+00:00Added an answer on June 2, 2026 at 3:52 am

    You need to close the option in your HTML:

    <option value="0">Select Account</option>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web page that allows users to insert form input objects with
I have a web app that lets users create groups. On the front page
Happy New Year SO users! I have an issue that I hope someone can
I have a HTML file, which generates a web page. Users can enter some
How can i set default home page in asp web.config file. i have already
I have web forms page that has 2 controls. A gridview and an associated
In my system Users can add/edit/view Customers . I would like to add a
I have a form on a simple web page that has a series of
I have a web page where users need to enter customer contact information. They
Can any one teach me how to use sessions? I have a login page

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.