I previously asked this question but need more help. Read this, then I will provide exact details at the end.
I have successfully transformed the static website I built for my podcast (www.noformatpodcast.com) into a dynamic website in Dreamweaver (on a testing server for now). I have done this without having to learn PHP or MySQL really at all by using the “Database”, “Bindings” and “Server Behaviors” tabs in Dreamweaver. THE ONLY THING I AM NOT ABLE TO FIGURE OUT is how to get a page to generate dynamically when some one clicks a link using information about that link to create the page. For example, I have a grid of dynamically generated episodes on the index.php page. When someone clicks the link for, say, episode 55, I want it to load the episode page (which I have already created) and fill in the information from episode 55 such as date, title, blurb etc. If someone clicks the link for episode 43, I want THE SAME page to load and dynamically populate the the page with the info from episode 43. Is this possible to do with Dreamweaver’s GUI, or do I need to grow up and learn to actually code?
The answers I got both told me I need to learn how to use $_GET. I’ve reviewed the basics of it at w3schools.com but still need a lot of help. Here is my dynamic repeating block of code that makes the grid of episodes on my index.php page
<div id="post_container">
<?php do { ?>
<div id="post">
<a href="episode.php" onmouseout="this.style.opacity=1;" onmouseover="this.style.opacity=0.7;">
<h2>
<span class="darkblock"><?php echo $row_Episodes['post_id']; ?> | <?php echo $row_Episodes['ep_title']; ?>
</span>
</h2>
<img src="ep_artwork/ep_<?php echo $row_Episodes['post_id']; ?>.jpg" width="260" height="260" />
</a>
</div>
<?php } while ($row_Episodes = mysql_fetch_assoc($Episodes)); ?>
</div>
So basically I have a bunch of big square images that are links to the episode.php page. I have coded the episode.php page to display data dynamically as well:
<div id="summary">
<div id="artwork">
<img src="ep_<?php echo $row_Episodes['post_id']; ?>.jpg" width="260" height="260" />
</div>
<div id="ep_title">Ep. <?php echo $row_Episodes['post_id']; ?> | <?php echo $row_Episodes['ep_title']; ?>
</div>
<p class="episode_date"><?php echo $row_Episodes['ep_date']; ?>
</p>
<p><?php echo $row_Episodes['ep_blurb']; ?>
</p>
</div>
<audio src="ep_media/ep_<?php echo $row_Episodes['post_id']; ?>.m4a" controls="controls">
</audio>
What I lack is the code to glue these two things together. I mean, as it stands now, if you click on any episode, it just takes you to the episode.php page and displays the info of the first episode (cause it’s the first in the database). I need to make it show the info OF THE EPISODE CLICKED. And I guess that involves using $_GET. Could someone show me EXACTLY what code I need to include, and where to include it? Is what I’ve posted here enough? Or do you need to know more info about my MySQL database as well?
There are many solutions, but the simplest I think would be if in your first page (the grid page or index.php), you make your links as follows:
Then in your episode.php page, you should read the get variables using
A suggested code would be:
You have to make your code secure as well. But this is the idea behind it.
My advise is to learn php and mysql to make life easier.
Cheers.