473,473 Members | 1,607 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Need help setting up data entry pages. Please help with code.

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!!!!
Jul 17 '05 #1
9 2489
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
:)
Jul 17 '05 #2
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.

Jul 17 '05 #3
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.

Jul 17 '05 #4
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/
Jul 17 '05 #5
> >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.
Jul 17 '05 #6
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/
Jul 17 '05 #7
> >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.
Jul 17 '05 #8
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/
Jul 17 '05 #9
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.

Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Guy | last post by:
I got a big Access file (1 400 tables) to convert to SQL and I would like to be provided with some automated tools, except upsizing wizard and DTS, to convert it on my own. I got a lot of forms...
3
by: Mike | last post by:
Hey guys I am pulling my hair out on this problem!!!!! Any help or ideas or comments on how to make this work I would be grateful! I have been working on this for the past 4 days and nothing I do...
4
by: Nip | last post by:
I am trying to make a database for my test participants. I have 10 participants and have a table with them called participants which includes an auto number ID and then the participant number and...
11
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field...
5
by: SRAM | last post by:
Hi, Problem statement: We have some amount of data stored in various excel sheets and we generate a few reports from these data. We are in the process of consolidating all data to reside in a...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
7
by: Kesavan | last post by:
Is there any way to run a function or a code-block whenever the client- server communication breaks off. (ie power-off, browser-crash...) Why I need this is, I want to update a login-table to...
2
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in...
5
by: Anan18 | last post by:
Hello sir, I'm supposed to Implement and Test the sequence Class Using a Fixed-Sized Array (Chapter 3), from Data Structures & Other objects using c++. The header file is provided, and so is a test...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.