Hello,
I have succesfully created a php page that will list the titles of songs from a table called LYRICS.
I have a field called TITLE, which is the title
and a field called WORDS, which are the words to the song.
When somebody selects a song, I would like the page to refresh, with the same listbox up top and following it, would be the lyrics to the song they selected....
I have attached the code, Please don't laugh too much. I am very new to PHP! What the code does now is creat the list box and pass the title to a var called $aid....
Thank you VERY much for your help in advance!!! This PHP/mySQL is making things very easy for my web site, but this one is making me lose some sleep!
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<?php
$dbcnx = @mysql_connect("*****", "*****", "*****");
if (!$dbcnx) {
echo( "<P>Unable to connect</P>" );
exit();
}
if (! @mysql_select_db("*******") ) {
echo ("<P>Unable to locate the database.</P>");
exit();
}
$title = mysql_query("SELECT title FROM lyrics");
$words = mysql_query("SELECT words FROM lyrics");
?>
<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=get>
<P>Please select the songBR>
<SELECT NAME="aid" SIZE=5>
<OPTION SELECTED VALUE="">Select One
<OPTION VALUE="">---------
<?php
while ($song = mysql_fetch_array($title)) {
$aname = $song["title"];
$aword = $song["words"];
echo("<OPTION VALUE='$aname'>$aname\n");
}
?>
</SELECT></P>
<P><INPUT TYPE=SUBMIT NAME="submit" VALUE="SUBMIT"></P>
</FORM>
?>
</body>
</html>
<Edited by klubrant on 12-15-2000 at 04:26 AM>



BR>

There may be others in a similar situation as you.

Bookmarks