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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:41:32+00:00 2026-06-06T06:41:32+00:00

I haven’t designed a website for about 3 years now, so I am quite

  • 0

I haven’t designed a website for about 3 years now, so I am quite rusty to say the least. I have to fall back on Dreamweaver CS5 to help me out.
Right…

I want a page for news, and the user/customer will select from a dropdown menu the date (JAN, FEB, MAR, APR etc…) Now, I have a table in my mySQL database called ‘news’ where each row is referenced by these dates. I have already set up a Dynamic List for the date (a dropdown list.)

What I want is for the customer to select the date from the dropdown, and for the results to show in a Recordset underneath. I am assuming that the SQL query needs to be wrote something along the lines of:

SELECT date, subject, message
FROM news
WHERE date = $ XXXXXDROPDOWNLIST XXX $

As you can see, I made the last line up because I can’t quite grasp how it should function. I am thinking that the dropdown list needs to be in a form which will POST and the table of results needs to be in a form which will GET.

Could somebody more technical than me please enlighten my dillema?

Thanks, Rob.

Code

mysql_select_db($database_rcc, $rcc);
$query_dropdowndate = "SELECT DATE_FORMAT(date, '%M %Y') AS FORMATTEDDATE FROM news GROUP BY FORMATTEDDATE ORDER BY Date DESC  ";
$dropdowndate = mysql_query($query_dropdowndate, $rcc) or die(mysql_error());
$row_dropdowndate = mysql_fetch_assoc($dropdowndate);
$totalRows_dropdowndate = mysql_num_rows($dropdowndate);

mysql_select_db($database_rcc, $rcc);
$query_newsitems = "SELECT `Date`, Subject, Message FROM news WHERE date = $_POST['dropdowndate']";
$newsitems = mysql_query($query_newsitems, $rcc) or die(mysql_error());
$row_newsitems = mysql_fetch_assoc($newsitems);
$totalRows_newsitems = mysql_num_rows($newsitems);
?>



<form id="choosedate" name="choosedate" method="post" action="#">
  <label for="dropdowndate"></label>
  <select name="dropdowndate" id="dropdowndate">
    <?php
do {  
?>
    <option value="<?php echo $row_dropdowndate['FORMATTEDDATE']?>"<?php if (!(strcmp($row_dropdowndate['FORMATTEDDATE'], $row_dropdowndate['FORMATTEDDATE']))) {echo "selected=\"selected\"";} ?>><?php echo $row_dropdowndate['FORMATTEDDATE']?></option>
    <?php
} while ($row_dropdowndate = mysql_fetch_assoc($dropdowndate));
  $rows = mysql_num_rows($dropdowndate);
  if($rows > 0) {
      mysql_data_seek($dropdowndate, 0);
      $row_dropdowndate = mysql_fetch_assoc($dropdowndate);
  }
?>
  </select>
  <input type="submit" name="submit" id="submit" value="Submit" />
</form>
<p>&nbsp;</p>
<form id="form1" name="form1" method="get" action="">
  <table border="0" cellpadding="5" cellspacing="2">
    <tr>
      <td>Date</td>
      <td>Subject</td>
      <td>Message</td>
    </tr>
    <?php do { ?>
      <tr>
        <td><?php echo $row_newsitems['Date']; ?></td>
        <td><?php echo $row_newsitems['Subject']; ?></td>
        <td><?php echo $row_newsitems['Message']; ?></td>
      </tr>
      <?php } while ($row_newsitems = mysql_fetch_assoc($newsitems)); ?>

Some of this may look weird so let me explain… The dynamic list (dropdown) is called ‘dropdowndate’ and the form is called ‘choosedate’ There is a button called ‘submit’ to submit the form. FORMATTEDDATE is the name given to the recordset which gives the dropdown menu a dynamic list.

I want the value from that dynamic list when user’s POST, to insert into the query as i mentioned … SELECT Date, Subject, Message FROM news WHERE date = $_POST[‘dropdowndate’]”; (THIS BIT IS PROBABLY WRONG)

Rob

  • 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-06T06:41:35+00:00Added an answer on June 6, 2026 at 6:41 am
    SELECT date, subject, message FROM news WHERE date = $_POST['fieldvalue']
    

    The $_POST variable contains all the data sent when the form is posted. The field value should correspond to the name you give the select field.

    This would be open to injection, so please ensure you use reasonable security measures.

    If you wish to get the data without refreshing, you will need to use AJAX the following explains it beautifully http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/ if you need more info on that just ask.

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

Sidebar

Related Questions

Haven't been programming in JS for a while. Now, I have following thing: <html>
Haven't seen anything about it here but it seems to solve one of the
I have a jquery bug and I've been looking for hours now, I can't
Haven't done as much of Javascript as I should have done. I am trying
I haven't seen this question anywhere else, I hope someone can help. I have
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
Haven't touch javascript for 3 years. Just got a javascript project and wanted to
Haven't seen anything, but I have seen that you can create albums in the
I haven't seen easy examples about rotaion around a specified point. I tried something

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.