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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:14:56+00:00 2026-05-25T02:14:56+00:00

How can i populate a mysql database with more than 1 dropdown lists ?

  • 0

How can i populate a mysql database with more than 1 dropdown lists ?

My code in html page is:

<form method="post" action="submit.php">

Number:  <select name="number">
  <option value="535">535</option>
  <option value="338">228</option></select>
<br>

Name: <select name="name">
<option value="John">John</option>
<option value="Dave">Dave</option></select>
<br>

<input type="submit" value="Add" />
</form>

My code in php is:

$Number = $_POST['number'] ;
$Name = $_POST['name'] ;

$query = "INSERT INTO submit (Number,Name) VALUES ('number','name')";

mysql_query($query) or die('Error Updating Database');
echo "Added";
  • 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-25T02:14:57+00:00Added an answer on May 25, 2026 at 2:14 am

    Yes, you can store the values from two different select lists in a MySQL query, but you need to actually insert the values that come back in $Number and $Name like so:

    $Number = mysql_real_escape_string($_POST['number']);
    $Name = mysql_real_escape_string($_POST['name']);
    
    $query = "INSERT INTO submit (Number,Name) VALUES ('$Number','$Name')";
    
    mysql_query($query) or die('Error Updating Database');
    echo "Added";
    

    I have also added mysql_real_escape_string() to help sanitise the user input before blindly inserting it into a database. This is a basic anti-SQL Injection measure.

    Of course you also need to already be connected to the MySQL server and have selected a database.

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

Sidebar

Related Questions

I'm trying to pull some html data from a mysql database to populate a
I'm trying to populate a dropdown list in my web page from a mysql
I am creating an update form where previously submitted information from a mysql database
I want to populate a mysql database with basic 'holiday resort' content e.g. name
How can I populate a dropdownlist in a .jsp page, retrieving fields names of
Suppose I do the following: I create a MySQL database, and populate it with
.hey guys how can i populate a dropdown list with the list of tables
I'd like to populate the MySQL timezone tables with the database provided by MySQL.
I have a class SomeClass, which can populate itself from a datarow in it's
How can I populate multiple datagrids in flex with a single datasource that is

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.