Sure you can Ron : Just give each submit button the same name, but a different ID in the html eg

<submit name="submit" id="delete" value="Delete" />
<submit name="submit" id="update" value="Update" />
<submit name="submit" id="manage" value="Management" />

When the user presses one of the buttons, look into the $_POST array and check if the value is set, for example

if (isset($_POST["submit"])) {
//  Check that the form was submitted using the submit button

        switch ($_POST["submit"])) {
        case 'Delete' :
//  Delete actions here

        case 'Udate' :
//  Update actions here

        case 'Management' :
//  Management actions here

//      Any catch-all actions if the forms submit button was spoofed
        }       //      End switch block

So, the submit value you're checking for should match that on the button.

Each block after the 'case' statement is followed by a 'break' statement.
If you *don't* do this, the code continues to execute all the other statements in the switch block.
Sometimes this is desirable but generally it ain't and can cause a headache if you leave it out.

You also have a 'default' statement which happens if none of the 'case's match - for example if somebody is trying to 'hotwire' your form to perform undesirable actions.

NB : You need to give them buttons different HTML *ID's* so that any javascript you use can tell the buttons apart in the DOM (otherwise the HTML DOM would be invalid, as you can't have more than one element on your web page with the same ID)

Cheers - Neil

At 12:52 16/10/2004 +0000, Ron wrote:
From: "Ron Piggott" <[EMAIL PROTECTED]>
Date: Fri, 15 Oct 2004 23:05:14 -0400
MIME-Version: 1.0
Content-Type: text/plain;
Content-Transfer-Encoding: 7bit
Subject: Form Processing

I would like to know if you are able to create a PHP web form that has
different "SUBMIT" buttons --- or if you used the HTML command

<SELECT NAME="approval_command">
<OPTION>Delete Record
<OPTION>Update And Approve For Listing
<OPTION>For Management

Basically I want the delete record to find the record in the mySQL
database --- I added the auto_increment yesterday to help develop the
editing module --- I want the Update and Approve For Listing to change a
variable value from "0" to "1" and to accept any changes the pre-viewer has
made --- for example writing in "United States" instead of US and "For
Management" to change the variable value to "2".

Are any of you able to help me with this question?

Sincerely thank you.

It would again help me if a copy of your response is sent to my e-mail

======================================================== CaptionKit : Production tools for accessible subtitled internet media, transcripts and searchable video. Supports Real Player, Quicktime and Windows Media Player.

VideoChat with friends online, get Freshly Toasted every
day at : NetMeeting solutions
for a connected world.

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to