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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:00:01+00:00 2026-06-05T07:00:01+00:00

Here’s my main form and download script. I need to pass some variables to

  • 0

Here’s my main form and download script. I need to pass some variables to download.php. These variables are derived from html select-list. How do I pass these variables to download.php?
Here’s my main form –

<td align="left"><select name="loc" id="loc" class="select-list">
    <option value="\">Choose</option>                                       
    <option value="aa">AA</br>
    <option value="bb">BB</br>
    </select>   
</td>
<strong>Click below to download:</strong> </br></br>
<span class="button" ><a href="download.php">Download (CSV)</a></span>

Here’s my download.php code –

header("Content-Disposition: attachment; filename=table.csv");
header("Content-type: text/csv");
$query = "SELECT * FROM table";
echo $out;
exit;

Now I want to pass the selected value from select-list to the download.php so that I can use predicates in my MYSQL SELECT query.

Any inputs please?? Thanks in advance.

  • 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-05T07:00:03+00:00Added an answer on June 5, 2026 at 7:00 am

    Not exactly sure if this is what you mean, but hopefully it helps.

    You need to use a HTML form with server-side PHP to handle the input.
    Try looking at w3schools’ tutorial. Here’s a (very basic) example:

    In the form:

    <form action="download.php" method="post">
    <select name="loc" id="loc" class="select-list">
    <option value="\">Choose</option>                                       
    <option value="aa">AA</br>
    <option value="bb">BB</br>
    </select>   
    <input type="submit" value="Download" />
    </form>
    

    In the download.php:

    <?php
    $val=$_POST['loc']; //this equals either aa or bb
    if($val == 'aa') {
      // do whatever 
    } else if($val == 'bb') {
      // do whatever
    } else {
      echo "Error";
    }
    ?>
    

    Also, make sure you sanitize your database queries, as well as initialize the db. w3schools link

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Here is an example of what I need http://code.google.com/webtoolkit/doc/latest/tutorial/gettingstarted.html I need interactive list to
Here's some CSS and HTML to make a textarea below a list of data
Here's my problem: I'm making a product upload module (main form) in C#. I
Here's my full, latest code that doesn't work. Here's the main window HTML <!DOCTYPE
Here is my complete script... You can just create test.php and throw it in.
Here is a complete example. I want to forbid using A::set from objects casted
Here is some simple code: DIR* pd = opendir(xxxx); struct dirent *cur; while (cur
Here is an example: I write html code inside of textarea, then I swap
Here is a simple timepicker to jQuery UI's datepicker <script type=text/javascript> /* <![CDATA[ */

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.