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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:22:09+00:00 2026-06-12T11:22:09+00:00

I have several drop down lists in a table, I am trying to retrive

  • 0

I have several drop down lists in a table, I am trying to retrive the value of the drop down list if its not 0.

I have a table of items each item has the drop down list. Below is how I create the drop down list, I give it the tableid as a name because this is a unique identifier for the particular product.

echo "<td><select name=". $row['goosedown_id'] .">
                <option value=''> 0 </option>
                <option>1</option>
                <option>2</option>
                <option>3</option>
                <option>4</option>
                <option>5</option>
                <option>6</option>
                <option>7</option>
                <option>8</option>
            </select>
        </td>";

Then once the form is submitted I am trying to just print any values i can… cause im not sure how to proceed… I do this like so.

$goosedown_id = check_input($_POST['goosedown_id']);
//..

goose down = $goosedown_id

I am hoping to be able to print out the associated values or calculate the price based off other items in the table i.e. price etc. but I am hoping someone can help me with trying to access the items that are no 0 first.

  • 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-12T11:22:10+00:00Added an answer on June 12, 2026 at 11:22 am

    Have a look at the following example:

    <!DOCTYPE html>
    <head>
        <link href="loginmodule.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <?php
        if (count($_POST)) {
            for ($i = 0; $i < $_POST["nr_rows"]; $i++) {
                echo "<h2>id=".$_POST["goosedown_id"][$i].", qty=".$_POST["qty"][$i]."</h2>\n";
            }
            die("<pre>".print_r($_POST, true)."</pre>\n");
        } else {
            // connect to the database
            $link = mysqli_init();
    
            // Adjust hostname, username, password and database name before use!
            $db = mysqli_real_connect($link, "localhost", "root", "", "test") or die(mysqli_connect_error());
    
            $SQL = "SELECT * FROM 5050goosedown ORDER BY price ASC";
            $result = mysqli_query($link, $SQL) or die(mysqli_error($link));
    
            $rows = array();
            for ($i = 1; $row = mysqli_fetch_assoc($result); $i++){
                $rows[] = array(
                    'id'        => $row['goosedown_id'],
                    'bgcolor'   => ($i % 2) ? '#F5F5F5' : '#E5E5E5',
                    'name'      => htmlentities($row['name']),
                    'size'      => ($row['width'] || $row['height']) ? $row['width'].'/'.$row['height'] : '',
                    'fill'      => $row['normal_fill'].'/'.$row['our_fill'],
                    'old_price' => $row['old_price'] ? $row['old_price'] : '',
                    'price'     => $row['price']
                );
            }
        }
        ?>
        <form action="<?= $_SERVER['SCRIPT_NAME'] ?>" method="post">
            <table border="0" width="600">
                <tr>
                    <th width="30%" colspan="2"><b>50/50 Goose Down:</b></th>
                    <th width="30%"><i>Normal Fill / Our Fill</i></th>
                    <th width="12.5%"><i>Old Price</i></th>
                    <th width="12.5%"><i>Price</i></th>
                    <th width="12.5%"><i>Quantity</i></th>
                </tr>
                <?php foreach ($rows as $row): ?>
                <tr bgcolor="<?= $row['bgcolor'] ?>">
                    <td><?= $row['name'] ?></td>
                    <td><?= $row['size'] ?></td>
                    <td><?= $row['fill'] ?></td>
                    <td><?= $row['old_price'] ?></td>
                    <td><?= $row['price'] ?></td>
                    <td>
                        <select name="qty[]">
                            <?php for ($i = 0; $i <= 8; $i++): ?>
                            <option value="<?= $i ?>"><?= $i ?></option>
                            <?php endfor ?>
                        </select>
                        <input type="hidden" name="goosedown_id[]" value="<?= $row['id'] ?>" />
                    </td>
                </tr>
                <?php endforeach ?>
            </table>
            <input type="submit" name="myButton" id="myButton" value="Submit" />
            <input type="hidden" name="nr_rows" value="<?= count($rows) ?>">
        </form>    
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page with several drop down lists that all have the same
Say that I have a web user control that has several drop down lists
I have created an html form. it consist of several drop down list for
I have several user controls that contain a drop down list, various validation controls,
So I have a drop down list and a several check boxes. The drop
I am developing a small desktop app, and there are several drop-down lists (combobox-es)
So I have all my drop down lists marked with class=ddl I used this,
I have a page with a ScriptManager, a generic HTML drop-down list ( <select>
In my program I have several very similar drop-down menus all with the same
I have Activity with ViewPager that contains several Fragments. I am also using drop-down

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.