Forums

PHP

This topic is locked

making mysql database results into links

Posted 21 Dec 2006 02:12:06
1
has voted
21 Dec 2006 02:12:06 james oglesby posted:
i am very new to php and have come across a problem.
i am making a poem website where the poet can login and input a title and poem
the data entered is then placed into a table called poems
all that works fine but i have a page that shows in a drop down list all the names of the titles in the database.
ie
choose a poem
poem 1
poem2
poem3
etc
all the is placed in the drop down list using this code below

<?php require_once('../../Connections/conDB.php'); ?>
<?php
mysql_select_db($database_conDB, $conDB);
$query_poems = "SELECT * FROM poems ORDER BY poem_id DESC";
$poems = mysql_query($query_poems, $conDB) or die(mysql_error());
$row_poems = mysql_fetch_assoc($poems);
$totalRows_poems = mysql_num_rows($poems);
?>

<!-- start of rightbox -->
<div id="rightbox">
<!-- start of rightpic -->
<div class="rightpic"></div>
<!-- end of rightpic -->
<!-- start of form -->
<form action="get" name="spool">
<select name="spool" size="1">
<option value="none">Choose a poem    </option>
<?php
do {
?>


<option value="none"><?php echo $row_poems['title']?></option>
<?php
} while ($row_poems = mysql_fetch_assoc($poems));
$rows = mysql_num_rows($poems);
if($rows > 0) {
mysql_data_seek($poems, 0);
$row_poems = mysql_fetch_assoc($poems);
}
?>
</select>
<input type="submit" value="go">

</form>
<!-- end of form -->
<!-- end of right -->

</div>
<!-- end of rightbox -->
<?php
mysql_free_result($poems);
?>

this code was made using dreamweaver by creating a dynamic form
i just dont understand how to get a record that is displayed in the list from the database to link to a results page so that poem can be shown
i need to do this as over time more and more poems will be added
#

PLease if anyone has any help please remember i am still quite new to php

i have tried to use go to details behavour but again i am just lost with the jargon

thanks in advance

james


Replies

Replied 23 Dec 2006 11:06:04
23 Dec 2006 11:06:04 E Brown replied:
You can find full tutorials on how to do this in your Dreamweaver help docs. Type in master/detail pages in the search box.

Reply to this topic