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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:32:41+00:00 2026-05-30T22:32:41+00:00

I am grabbing some values from my database and putting them in a drop

  • 0

I am grabbing some values from my database and putting them in a drop down box for users to select. I have Spry Validations (inbuilt with dreamweaver) and so at least one option has to be chosen before submitting its data. For some weird odd reason, i have a blank value after each option which does not make sense as my database does not contain any blank fields.

    <?php 

$id = $_GET['election'];

$sql="SELECT party1, party2, party3 FROM elections WHERE status = 'in_progress' AND election_id = '$id'";

$result=mysql_query($sql);

$options="";
$party2="";
$party3="";

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

    $id=$row["party1"];
    $thing=$row["party1"];
    $options.="<OPTION VALUE=\"$id\">".$thing;

    $id=$row["party2"];
    $thing=$row["party2"];
    $party2.="<OPTION VALUE=\"$id\">".$thing; 

    $id=$row["party3"];
    $thing=$row["party3"];
    $party3.="<OPTION VALUE=\"$id\">".$thing;
}
  ?>

my form looks like this:

    <form action="" method="post">

    <span id="spryselect1">
    <label for="vote">Vote:</label>
    <select size="1">
        <option selected="selected">Choose</option>
        <option value="1"><?=$options?></option>
        <option value="2"><?=$party2?></option>
        <option value="3"><?=$party3?></option>
</select>
    <span class="selectRequiredMsg">Please select an item.</span></span>

    <input name="" type="submit" value="Vote" />
  </form>

does anyone know why i keep getting blank values? I have attached an image to show you what i mean…empty drop down values

  • 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-30T22:32:43+00:00Added an answer on May 30, 2026 at 10:32 pm

    You’re adding an option tag into the variables:

    $options.="<OPTION VALUE=\"$id\">".$thing;
    

    but you’re also wrapping the variable in an option tag while outputting:

    <option value="1"><?=$options?></option>
    

    The result will be:

    <option value="1"><OPTION VALUE="..">...</option>
    

    which gives the empty tag.

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

Sidebar

Related Questions

Pretty much as the title states, I'm grabbing some values from a Db, which
I have a JS/PHP piece of code that selects from a database, does some
I'm grabbing some data from a database that has a stored date value, and
I'm grabbing some binary data out of my MySQL database. It comes out as
I am having trouble grabbing the values from the form once processed. I need
I have a xsl file that is grabbing variables from xml and they seem
I have this method for grabbing the file name from a string URI. What
I have some HTML and I need to extract the actual written text from
I am working on doing some data transfers moving data from one database to
I'm interested in grabbing the EPG data from DVB-T streams. Does anyone know of

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.