Hi all,
Could you please help me out on this one.
I want to create a web site using two tables.
1. page_creation - Stores page_id and page_name to be shown on all
navigation bars.
2. pages - Contains pg_id, page_id, etc etc.
I want to do an insert into page_creation to create a new page and then pass
the page_id to pages, so I know the info stored in "pages" relates to a
certain page (one to many relationship).  In the code below I want this to
be an "Add a New web Page" where the user types in a Page Name shown in the
nav bar and it enters data as above.
I have been trying for three days now with different methods and it is
driving me mad.
Thank you in advance for your assistance
 

<?
if ($page_name) {
 
$host="db9.pair.com";
$user="c3po";
$password="13Balreask";
$dbasename="c3po_test";
 
mysql_pconnect("$host","$user","$password")
or die("Unable to connect to SQL server");
mysql_select_db("$dbasename") or die("Unable to select database");
    
$sql1 = "INSERT INTO page_creation pagename";
$sql1 = "values('$page_name')";
$result = mysql_query($sql1);
$sql2 = "INSERT INTO pages page_id values('$result');
$result2 = mysql_query($sql2);
}
else {
?>
<HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<FORM ACTION="test_2_tables.php" METHOD="POST">
<INPUT TYPE=TEXT name="page_name" VALUE="<?echo $page_name ?>" SIZE=20>
<INPUT TYPE=SUBMIT VALUE="Add a New Page">
</FORM>
</BODY>
</HTML>
<? }
?>

 
 

Lisa Rubanowicz 
Case ITC, 
Navan, Ireland 
Tel: #353 (0)46 77663

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

 

Reply via email to