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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:22:51+00:00 2026-06-18T19:22:51+00:00

I can call the values of the drop down box from the database, but

  • 0

I can call the values of the drop down box from the database, but I can’t save the selected value in a new row within the database. Can someone please tell me where I’m going wrong?

if (isset($_POST["addDestination"]) && $_POST["addDestination"]=="yes")
{
    $countriesName=$_POST["countriesName"];
    $Name=$_POST["Name"];
    $photo=$_POST["photo"];
    $description=$_POST["description"];
    $Airport=$_POST["Airport"];
    $Airport2=$_POST["Airport2"];
    $Airline=$_POST["Airline"];
    $Airline2=$_POST["Airline2"];
    $Airline3=$_POST["Airline3"];
    $Airline4=$_POST["Airline4"];

    $dbQuery= "INSERT INTO destinations VALUES( NULL, '$countriesName', '$Name', '$photo', '$description', '$Airport', '$Airport2', '$Airline', '$Airline2', '$Airline3', '$Airline4')";
    $result= mysql_query($dbQuery,$db);

The html code and php code that call the values in from the database is:

<form id="addDestination" name="addDestination" method="post" action="addDestination.php">
    <input type="hidden" name="addDestination" value="yes">
    <div id="countriesName" class="info"><span class="formLabel">Country (Please select one of the following)</span><br>
    <?php 
      echo "<p></p>";
      $dbQuery="SELECT Name FROM countries order by name asc";
      $dbResult=mysql_query($dbQuery);
      echo "<select name=\"Name\">";
      while ($dbRow=mysql_fetch_array($dbResult)) {
        $Name=$dbRow["Name"];
        echo "<option value='$Name'>$Name</option>";
      }
      echo "</select>";
      echo "<p> </p>";
    ?>
  </div>

When I try to save a selected value, the field in the database stays blank.

  • 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-18T19:22:52+00:00Added an answer on June 18, 2026 at 7:22 pm

    I think this might be that rather than:

    $countriesName=$_POST["countriesName"];
    

    you may need to use:

    $countriesName=$_POST["Name"];
    

    "Name" is the name of your actual HTML select, rather than "countriesName" which is the containing div.

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

Sidebar

Related Questions

I've created a form and populating its value from Category model in drop down
I am trying to obtain all the values stored in a list box/drop down
I have a drop-down list box and two text fields of id values namely
I have my own view with some values. How i can call on click
How can one call a ColdFusion function, passing in attribute values as arguments, inside
How can i skip first argument without giving any value in function call,so that
I want to call this procedure that sends one value that can be NULL
From this code I can call bmwCars.CopyToDataTable() as I expected. var bmwCars = from
I have this simple Select box that is suppose to store the selected value
I have a list of Payees in a drop down box on my form.

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.