473,594 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ 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_n ews_insert_proc essor.php" method="post"
name="frm_Inser t_News" id="frm_Insert_ News">
Here's the insert query. This code is on the page
admin_news_inse rt_processor.ph p:
<?php
$query_rs_inst_ news = "INSERT INTO News (ID, Headline, Opener, Story,
Imageloc, Anchor, Artist_ID) VALUES
('".$_POST['News_Headline']."','".$_POS T['News_Opener']."','".$_POS T['News_Story']."','".$_POS T['News_Image_Loc ']."','".$_POS T['News_Anchor']."','".$_POS T['News_Artist']."');";
$rs_inst_news = mysql_query($qu ery_rs_inst_new s);

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 2496
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_n ews_insert_proc essor.php" method="post"
name="frm_Inser t_News" id="frm_Insert_ News">
Here's the insert query. This code is on the page
admin_news_inse rt_processor.ph p:
<?php
$query_rs_inst_ news = "INSERT INTO News (ID, Headline, Opener, Story,
Imageloc, Anchor, Artist_ID) VALUES
('".$_POST['News_Headline']."','".$_POS T['News_Opener']."','".$_POS T['News_Story']."','".$_POS T['News_Image_Loc ']."','".$_POS T['News_Anchor']."','".$_POS T['News_Artist']."');";
$rs_inst_news = mysql_query($qu ery_rs_inst_new s);

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($qu ery_rs_inst_new s);

//*** 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*****@firstd basource.com> wrote in message news:<y4******* *********@newss vr24.news.prodi gy.com>...
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_n ews_insert_proc essor.php" method="post"
name="frm_Inser t_News" id="frm_Insert_ News">
Here's the insert query. This code is on the page
admin_news_inse rt_processor.ph p:
<?php
$query_rs_inst_ news = "INSERT INTO News (ID, Headline, Opener, Story,
Imageloc, Anchor, Artist_ID) VALUES
('".$_POST['News_Headline']."','".$_POS T['News_Opener']."','".$_POS T['News_Story']."','".$_POS T['News_Image_Loc ']."','".$_POS T['News_Anchor']."','".$_POS T['News_Artist']."');";
$rs_inst_news = mysql_query($qu ery_rs_inst_new s);

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($qu ery_rs_inst_new s);

//*** 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($qu ery_artists);
$row_artists = mysql_fetch_ass oc($artists);
?>

<?php
$query_rs_inst_ news = "INSERT INTO News (Headline, Opener, Story,
ImageLoc, Anchor, Artist_ID) VALUES
('".$_POST['News_Headline']."','".$_POS T['News_Opener']."','".$_POS T['News_Story']."','".$_POS T['News_Image']."','".$_POS T['News_Anchor']."','".$_POS T['News_Artist']."');";
$rs_inst_news = mysql_query($qu ery_rs_inst_new s);
?>
<?php
Header ("Location: http://www.yeahthatroc ks.com/master.php");
?>
dj*******@hotma il.com (Don Seckler) wrote in message news:<fe******* *************** ****@posting.go ogle.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*****@firstd basource.com> wrote in message news:<y4******* *********@newss vr24.news.prodi gy.com>...
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_n ews_insert_proc essor.php" method="post"
name="frm_Inser t_News" id="frm_Insert_ News">
Here's the insert query. This code is on the page
admin_news_inse rt_processor.ph p:
<?php
$query_rs_inst_ news = "INSERT INTO News (ID, Headline, Opener, Story,
Imageloc, Anchor, Artist_ID) VALUES
('".$_POST['News_Headline']."','".$_POS T['News_Opener']."','".$_POS T['News_Story']."','".$_POS T['News_Image_Loc ']."','".$_POS T['News_Anchor']."','".$_POS T['News_Artist']."');";
$rs_inst_news = mysql_query($qu ery_rs_inst_new s);

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($qu ery_rs_inst_new s);

//*** ID, removed assuming it is an autoincrement field.

Jul 17 '05 #4
I noticed that Message-ID:
<fe************ *************@p osting.google.c om> 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
8251
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 and query to convert too. Can someday provide me with at least one tool name ? Thanks,
3
1583
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 seems to get me any closer to the solution. Below is a program that I am working on for a class project. The original code was provided for us which is what I have below. What we have to do is make the app run so that it allows the user to add...
4
1520
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 start date. Now I want to rank these participants. So I have created 3 more tables one is called rankdescription and includes 5 ranking descriptions which all 10 participants will have to rank. The 2nd table is rankdate and includes 8...
11
2791
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 (strPubCity) for Publisher City. These two fields have a many-to-one relationship with tables, (tlkpPubName and tlkpPubCity) respectively. The lookup tables only have one field (strPubName and strPubCity), which is their primary key. I also have...
5
5312
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 single repository. Currently, it is semi-automated i.e. we are using MS Excel for data entry, consolidation and report generation (i.e. using formulas). We require a tool that will provide: a) A web-based interface for data entry (i.e. remote,
16
2516
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 uses IE to talk with a server. The user on the client (IE) sees an ASP net page containing a TextBox. He can write some text in this text box and push a submit button.
7
2113
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 trace user's leave the portal without proper log-off or sign-out. Every time a user at proper sign-in, a flag is set & account is locked until he sign-out by updating in the login-table.At sign-out the flag is released & his account is ready to...
2
3561
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 uby/Rails. I started it in Perl and gave up on Perl as I went from the 'display the database information on the web page' to the 're-display the information from the database and allow the user to update the database using the web page' stage and realized...
5
6601
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 program to check the correctness of the sequence class. I cannot figure out what the problem is and keep looking back and forth at the textbook and its not helping, can someone please please help me , i cannot figure out the errors in the...
0
7941
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7874
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8246
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8000
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8231
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5738
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2383
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 we have to send another system
1
1476
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1205
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.