Reply to Re: Input and Display Records With Same Script?

Your name:

Reply:


Posted by Paul Lautman on 05/18/06 17:21

Bob Sanderson wrote:
> I am trying to create a form for a MySQL database similar to a
> spreadsheet. The idea is to display a list of records, with the last
> line of the list being an input form. When the user enters data in
> the form and hits the submit button, the data is entered and the form
> is reloaded with the new data displayed and another input form
> becomes the last line.
>
> Example ---
>
> Before entering new data
>
> Record 1
> Record 2
> Record 3
> Input form Submit button
>
>
> After entering new data
>
> Record 1
> Record 2
> Record 3
> Record 4
> Input form Submit button
>
> It seems is what I think the approach should be:
>
> 1. Display all current records - the last line is an input form
> 2. User adds data to the form and hits the Submit button
> 3. The form action calls the same script
> 4. The new data is entered into the database
> 5. Back to step one
>
> Does this make sense or is there a better way? How do I structure the
> queries to accomplish this?
>
> Thanks in advance.

Funny you should ask, I just did a similar thing, except my input was at the
top with the records displayed in descending order.

1) Check if form has been submitted
1a) if form has been submitted, INSERT data into database
2) Query database to get all records
3) Output all records
4) Output Form elements

That's it. You may want to edit-check the data and send an error message if
the data doesn't pass muster.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация