View Full Version : Dynamic URL landing page

01-27-2012, 10:40 PM
Hello All,

I'm new to PHP and perhaps i am doing this in the wrong order...
I've been working on an events listing site http://www.hedgevent.com

and currently all the regular and search listings are hyperlinked yet have nowhere to go...how do i make them all point to one dynamic place when clicked??

Basically i'm looking to make a details page that displays different content depending on which one of the echoed links you click...

I was able to get echoed data from one of my tables to produce hyperlinked urls... here's the rub, ive never built a dynamic page or an htaccess file.

here is a snippet of the code the develops the links on the home page(not sure if this is right-feedback encouraged):

if ($query_run = mysql_query($query)) {
while ($query_row = mysql_fetch_assoc($query_run) ) {
$id= $query_row ['id'];
$event= $query_row ['event'];
$company= $query_row ['company'];
$location= $query_row ['location'];
$city= $query_row ['city'];
$month= $query_row ['month'];
$day= $query_row ['day'];
$year= $query_row ['year'];

$urlevent = str_replace(" ","_", $event);

echo '<div class="where"><a href="http://www.hedgevent.com/details/'.$urlevent.'-'.$id.'.html" class="event">'.$event.'</a></div>'.$company.'<div class="date">'.$month.'/'.$day.'/'.$year.'</div> - '.$location.', '.$city.'<br><hr style= margin-top:5px;margin-bottom:5px;/>';

and I am trying to get this link to direct to a landing page with the unique url yet I want to have one static page design that can be used to show those table details.

Does anyone know how these pages are created? Any help or direction would go a long way as I am lost on this after reading internet articles about .htaccess

01-28-2012, 04:06 AM
you need an identifier in the link that is clicked so you can retrieve records from the db for that particular item/event

the identifier can be a number or a string

in your links on the page you need to include the identifier, eg; one of your links ends with 'Cocktails_On_The_Sound-100.html'

When calling that event out of the database and listing it on the list page you could add the id into the url, eg;

echo '<div class="where"><a href="http://www.hedgevent.com/details/'.$urlevent.'-'.$id.'.html?id='.$id.'" class="event">'.$event.'</a></div>'.$company.'<div class="date">'.$month.'/'.$day.'/'.$year.'</div> - '.$location.', '.$city.'<br><hr style= margin-top:5px;margin-bottom:5px;/>';

then when you click on the link and it goes to the processing page you would be able to retrieve the data for the event with id = 1

on the receiving page

$id = $_GET['id'];

does that make sense?

01-28-2012, 03:50 PM
what should I call the receiving file so that they connect?

using the example above should i put the id code $id = $_GET['id']; on the page details.html (or .php)?

How would I name the page to take into account the "/'.$urlevent.'-'.$id.'.html" part