Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Add link to PHP Populated drop down menu

Posted on 2011-09-13
2
Medium Priority
?
459 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
PranjalShah earned 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

610 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