1)Everything from the data entry form is going into the db (Thanks to
Michael), except for the data from the News_Image form field into the
ImageLoc db field. I can't figure out why?
2)My Header statement isn't redirecting the browser page. I don't
know why.
<?php
$query_artists = "SELECT * From Artists ORDER BY Artist";
$artists = mysql_query($query_artists);
$row_artists = mysql_fetch_assoc($artists);
?>
<?php
$query_rs_inst_news = "INSERT INTO News (Headline, Opener, Story,
ImageLoc, Anchor, Artist_ID) VALUES
('".$_POST['News_Headline']."','".$_POST['News_Opener']."','".$_POST['News_Story']."','".$_POST['News_Image']."','".$_POST['News_Anchor']."','".$_POST['News_Artist']."');";
$rs_inst_news = mysql_query($query_rs_inst_news);
?>
<?php
Header ("Location: http://www.yeahthatrocks.com/master.php");
?>
djseckler@hotmail.com (Don Seckler) wrote in message news:<fe6bb0b0.0408030511.1236ab50@posting.google. com>...[color=blue]
> Thanks for the response Michael.
>
> Yes the ID is an auto increment.
>
> Should the bit that comes after POST in the brackets be the names of
> the fields form the data entry form?
>
>
> Michael Austin <maustin@firstdbasource.com> wrote in message news:<y4CPc.2809$wL3.687@newssvr24.news.prodigy.co m>...[color=green]
> > Don Seckler wrote:[color=darkred]
> > > I am trying to set up a PHP web page so I can enter data into a
> > > database.
> > >
> > > I created a form:
> > >
> > >
> > > <form action="admin_news_insert_processor.php" method="post"
> > > name="frm_Insert_News" id="frm_Insert_News">
> > >
> > >
> > > Here's the insert query. This code is on the page
> > > admin_news_insert_processor.php:
> > >
> > >
> > > <?php
> > > $query_rs_inst_news = "INSERT INTO News (ID, Headline, Opener, Story,
> > > Imageloc, Anchor, Artist_ID) VALUES
> > > ('".$_POST['News_Headline']."','".$_POST['News_Opener']."','".$_POST['News_Story']."','".$_POST['News_Image_Loc']."','".$_POST['News_Anchor']."','".$_POST['News_Artist']."');";
> > > $rs_inst_news = mysql_query($query_rs_inst_news);
> > >
> > > I don't know if this query is written correctly. Should
> > > '".$_POST[this]."' be the names of the form fields on the form from
> > > the first page?
> > >
> > > Is the rest of the query written correctly?
> > >
> > > Help me please!!!![/color]
> >
> > you are missing 'ID' in the values clause. if this is an "auto-increment" field
> > then it should not appear in the (fields,,,,,) part of the INSERT statement.
> > You have 7 fields listed and only 6 "values".
> >
> > $query_rs_inst_news =
> > "INSERT INTO News (
> > Headline,
> > Opener,
> > Story,
> > Imageloc,
> > Anchor,
> > Artist_ID)
> > VALUES
> > ('".$_POST['News_Headline'].
> > "','" . $_POST['News_Opener'] .
> > "','" . $_POST['News_Story'].
> > "','" . $_POST['News_Image_Loc'].
> > "','" . $_POST['News_Anchor'].
> > "','" . $_POST['News_Artist'].
> > "');";
> > $rs_inst_news = mysql_query($query_rs_inst_news);
> >
> > //*** ID, removed assuming it is an autoincrement field.[/color][/color]