I have the following to pages( just testing them at the moment ):
<? mysql_connect("host","xxxx","xxxx");
mysql_select_db("music");
echo "<form name='add_album' method='post' action='test-album-add.php'>";
$getlist = mysql_query("SELECT * FROM music_artist ORDER BY
artist_name ASC");
echo " Artist Name : <select name=\"artist_name\">\n";
while ($row = mysql_fetch_array($getlist)) {
echo '<option value="'.$row["id"].'">'.$row["artist_name"]."</option>\n";
}
echo " </select>\n";
echo "<br>Album Name : <input type='text' name='album' value='$album'>";
echo "<input type='submit' name='Submit' value='Submit'>";
echo "</form>";
?>
and
<?
include("../mainfile.php");
include("../header.php");
OpenTable();
mysql_connect( "host", "xxxx", "xxxx" );
mysql_select_db( "xoops" );
$query_id = mysql_query("INSERT INTO music_album VALUES
(NULL, '$music_artist.id' ,'$album' ,NULL ,NULL)");
echo " $artist_name and $album has been added to the
database.";
CloseTable();
include("../footer.php");
?>
What I am trying to do is insert the id of the artist they selected in
the first page into a second table. At the moment all I get is 0
inserted instead of the artist id from page 1.
Could someone please point out what I'm doing wrong?
Thanks in advance.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php