Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    84
    Thanks
    49
    Thanked 0 Times in 0 Posts

    Dynamic URL landing page

    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):

    PHP Code:
    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

  • #2
    Regular Coder
    Join Date
    Jan 2012
    Posts
    271
    Thanks
    2
    Thanked 65 Times in 65 Posts
    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;
    'Cocktails_On_The_Sound-100.html?id=1'

    PHP Code:
    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
    PHP Code:
    $id $_GET['id']; 
    does that make sense?
    Last edited by jmj001; 01-28-2012 at 03:08 AM.

  • Users who have thanked jmj001 for this post:

    jchrisphonte (01-29-2012)

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    84
    Thanks
    49
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •