Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
PHP - Value of a Submit
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Warren Michelsen  
View profile  
 More options Nov 20 2009, 3:58 pm
From: Warren Michelsen <wmichel...@gmail.com>
Date: Fri, 20 Nov 2009 13:58:33 -0700
Local: Fri, Nov 20 2009 3:58 pm
Subject: PHP - Value of a Submit

If a form has multiple Submit buttons, how does one find, in php, the value of the submit that was used?

That is, I have one submit to 'Modify' and another to 'Delete" the submitted form data.
<input name="Delete" type="submit" value="Delete">
<input name="Submit" type="submit" value="Modify">

if($_POST['Submit'])

Seems only to provide confirmation that a form was submitted. How do I extract the value of the Submit button that was used?

How can I use php to tell me which of the above Submits was used?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bill  
View profile  
 More options Nov 20 2009, 6:00 pm
From: bill <w...@wereveal.com>
Date: Fri, 20 Nov 2009 15:00:25 -0800 (PST)
Local: Fri, Nov 20 2009 6:00 pm
Subject: Re: PHP - Value of a Submit
$_POST will contain the key/values for each form elements that are
submitted and have values by element name. As such, using your
example, when the Delete submit button is clicked, $_POST["Delete"]
will be created with the value of "Delete" but there will not be a
$_POST["Submit"] created or have a value since it wasn't clicked.

On Nov 20, 2:58 pm, Warren Michelsen <wmichel...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Govinda  
View profile  
 More options Nov 20 2009, 6:07 pm
From: Govinda <govinda.webdnat...@gmail.com>
Date: Fri, 20 Nov 2009 16:07:08 -0700
Local: Fri, Nov 20 2009 6:07 pm
Subject: Re: PHP - Value of a Submit

> If a form has multiple Submit buttons, how does one find, in php,  
> the value of the submit that was used?

> That is, I have one submit to 'Modify' and another to 'Delete" the  
> submitted form data.
> <input name="Delete" type="submit" value="Delete">
> <input name="Submit" type="submit" value="Modify">

> if($_POST['Submit'])

> Seems only to provide confirmation that a form was submitted. How do  
> I extract the value of the Submit button that was used?

> How can I use php to tell me which of the above Submits was used?

get the *name* of the variable coming in...  write conditionals based  
on that.
I am not in PHP mode these days, so you'll have to check syntax/write  
it yourself..  but something like (pseudo code) -

$deleteVar=$_POST['Delete'];
$sumitVar=$_POST['Submit'];

if ($deleteVar=="Delete") {
  dosomething;

} elseif ($sumitVar =="Modify") {
  dosomethingElse;
}

..just to give an idea of one myriad ways you can approach this.

------------
Govinda
govinda.webdnat...@gmail.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »