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!!!! 9 2317
Don Seckler wrote: 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!!!!
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.
--
Michael Austin.
Consultant - Available.
Donations welcomed. Http://www.firstdbasource.com/donations.html
:)
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 <ma*****@firstdbasource.com> wrote in message news:<y4****************@newssvr24.news.prodigy.co m>... Don Seckler wrote: 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!!!!
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.
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");
?> dj*******@hotmail.com (Don Seckler) wrote in message news:<fe**************************@posting.google. com>... 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 <ma*****@firstdbasource.com> wrote in message news:<y4****************@newssvr24.news.prodigy.co m>... Don Seckler wrote: 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!!!!
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.
I noticed that Message-ID:
<fe*************************@posting.google.com> from Don Seckler
contained the following: 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?
Perhaps it should be $_POST['News_Image_Loc'] ? 2)My Header statement isn't redirecting the browser page. I don't know why.
Try a lower case 'h'
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
> >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?
Perhaps it should be $_POST['News_Image_Loc'] ?
I had used News_Image_Loc before and that wasn't working, so I changed
the name of the data entry form text field to News_Image in hope that
maybe that would work... 2)My Header statement isn't redirecting the browser page. I don't know why.
Try a lower case 'h'
I had a lower case "H" previuosly, and taht wasn't working so I tried
upper.
But thanks for the suggestions.
I noticed that Message-ID:
<fe**************************@posting.google.com > from Don Seckler
contained the following: Perhaps it should be $_POST['News_Image_Loc'] ? I had used News_Image_Loc before and that wasn't working, so I changed the name of the data entry form text field to News_Image in hope that maybe that would work...
Call it 'x' - no chance of mistyping that..LOL. Personally, I stick to
lowercase only - less chance of mistakes. This is just a textfield
right? You're not using an image field and browsing for a picture or
anything daft like that? > >2)My Header statement isn't redirecting the browser page. I don't >know why. Try a lower case 'h'
I had a lower case "H" previuosly, and taht wasn't working so I tried upper.
Is there anything after it? Try putting exit; after the header
function.
Are you getting an error message? Try removing any white space, like
between the php tags. But thanks for the suggestions.
NP
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
> >I had used News_Image_Loc before and that wasn't working, so I changed the name of the data entry form text field to News_Image in hope that maybe that would work... Call it 'x' - no chance of mistyping that..LOL. Personally, I stick to lowercase only - less chance of mistakes. This is just a textfield right? You're not using an image field and browsing for a picture or anything daft like that?
It's a text field. I'm trying to post a URL that will point to the
image. Is that daft? lol I don't know I'm a complete newbie. > >2)My Header statement isn't redirecting the browser page. I don't >know why.
Try a lower case 'h'
I had a lower case "H" previuosly, and taht wasn't working so I tried upper.
Is there anything after it? Try putting exit; after the header function.
I'll have to check.
Are you getting an error message? Try removing any white space, like between the php tags.
No error, just sticking on the processing page.
I noticed that Message-ID:
<fe**************************@posting.google.com > from Don Seckler
contained the following: right? You're not using an image field and browsing for a picture or anything daft like that? It's a text field. I'm trying to post a URL that will point to the image. Is that daft? lol I don't know I'm a complete newbie.
No that's fine. Are you getting an error message? Try removing any white space, like between the php tags. >
No error, just sticking on the processing page.
I think we'll have to see all the code, from both pages.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Geoff,
Thanks for your help.
I took out all the white space and added the exit() and now the field
fills inproperly and the redirect works perfectly.
I don't understand how tose changes affected that problem field, but
hey it works!
Geoff Berrow <bl******@ckdog.co.uk> wrote in message news:<6k********************************@4ax.com>. .. I noticed that Message-ID: <fe**************************@posting.google.com > from Don Seckler contained the following:
right? You're not using an image field and browsing for a picture or anything daft like that?
It's a text field. I'm trying to post a URL that will point to the image. Is that daft? lol I don't know I'm a complete newbie.
No that's fine.
Are you getting an error message? Try removing any white space, like between the php tags. >
No error, just sticking on the processing page.
I think we'll have to see all the code, from both pages. This discussion thread is closed Replies have been disabled for this discussion. Similar topics
12 posts
views
Thread by Guy |
last post: by
|
3 posts
views
Thread by Mike |
last post: by
|
4 posts
views
Thread by Nip |
last post: by
|
11 posts
views
Thread by my-wings |
last post: by
|
5 posts
views
Thread by SRAM |
last post: by
|
16 posts
views
Thread by pamelafluente |
last post: by
|
7 posts
views
Thread by Kesavan |
last post: by
| | | | | | | | | | | | |