Solved

Add link to PHP Populated drop down menu

Posted on 2011-09-13
2
392 Views
Last Modified: 2012-05-12
I have a dropdown menu working which populates it's info from a database using PHP.

The query code is...

<?php

$dbhandle = new mysqli('localhost', 'un', pw, 'db');
$result = $dbhandle->query("SELECT e.*, DATE_FORMAT(`eventdate`,'%Y') as y FROM `events` e WHERE (`title` IS NOT NULL) AND Trim(`title`)!='' ORDER BY `eventdate` DESC");

$curyear = null;
while ($row = $result->fetch_object())
{
      if( $curyear!=$row->y )
      {
            if ($curyear != null) echo '</div>';
            $curyear=$row->y;
            echo '<div class=header id=divHeader', $curyear, '>', $curyear, '</div>';
            echo '<div class=content id=divContent', $curyear, '>';
      }
        echo $row->title, '<br />';
}
echo '</div>';
$dbhandle->close();
?>


It's all working fine ...http://www.anjoman.co.uk/previous-eventsbin.php

All I need to do is add a link to the event title that appear when the date is clicked.

The URL they need to go to is the event details page...<a href="previous-events-archive.php?date=<?php echo $row_events['eventdate']; ?>

I can't figure out where and how to place this link and would be grateful for any suggestions..

0
Comment
Question by:BrighteyesDesign
2 Comments
 
LVL 8

Accepted Solution

by:
PranjalShah earned 500 total points
ID: 36531740
Do you need to get the eventdate from one more query? I think your current query is getting the eventdate

so change your title line to...


echo "<a href=previous-events-archive.php?date=".$row->eventdate.">".$row->title."</a>";
0
 

Author Comment

by:BrighteyesDesign
ID: 36531868
Yep, that's done it, thanks for your help
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Encode a password 2 38
Adding Extra Information box 4 25
Not needed 13 55
What is the Best Editor for PHP Development ? 5 30
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now