RE: [PHP] updating a database
| From: | Ashley Sheridan | Date: | Wed, 14 Jul 2010 18:29:23 +0000 |
| Subject: | RE: [PHP] updating a database | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-306892@lists.php.net to get a copy of this message | ||
On Wed, 2010-07-14 at 10:29 -0400, Bob McConnell wrote:
> From: David Mehler
>
> > What i'm trying to do certainly doesn't seem hard conceptually, but
> > coding it has been rough. I'm wondering if anyone has anything
> > similar.
> > I've got a database with records. The first time the page is accessed
> > the submit button won't be selected, so display information about the
> > record with a checkbox for selection. If a user selects a checkbox and
> > hits submit, display only that specific record in a form for editing,
> > once editing is complete feed the edited data back to the database.
> > I'd like all this to be done in a single sticky file.
> > If anyone has any code similar to this i'd appreciate getting a look,
> > mine is nonworking.
>
> Mine looks something like this
>
> -----8<-------------------------------------------
> $Submit = $_POST['Submit'];
>
> if (isset($CCsubmit)) {
> //////// DELETE
> if ($Submit == "Delete") {
> // Check to see if user authorized, then delete record
>
> }
> //////// NEW
> else if ($Submit == "New" || $Submit == "Next"){
> // Issue empty form or next record
>
> }
> //////// EDIT
> else if ($Submit == "Save") {
> // Validate and ssve the updated data. Reissue if validation
> fails.
>
> }
> }
> else {
> // Issue form with initial data
>
>
>
> }
> -----8<-------------------------------------------
>
> You should also check in the Save option to see if anything was actually
> changed. The record shouldn't be updated if nothing was edited.
>
> Bob McConnell
>
David, are you looking for something broad or specific? phpMyAdmin does
what you want, so might be a good starting point?
Thanks,
Ash
http://www.ashleysheridan.co.uk