Hello,
I have a self - submitting form with multiple submits and I want to
detect after the submit which button is pressed.
Code example:
<form name="example" method="post" action="/test.php">
<input type =submit name="add"> form elements but also
<a href="#" onClick=documen t.myForm.submit ()>edit</a>
<a href="#" onClick=documen t.myForm.submit ()>modify</a>
</form>
If I submit the form by clicking either of these elements, how do I
detect in PHP which element was used to submit the form?
TIA,
Marc 5 7764
Marc wrote: Hello,
I have a self - submitting form with multiple submits and I want to detect after the submit which button is pressed.
Code example: <form name="example" method="post" action="/test.php"> <input type =submit name="add"> form elements but also
<a href="#" onClick=documen t.myForm.submit ()>edit</a> <a href="#" onClick=documen t.myForm.submit ()>modify</a>
</form>
If I submit the form by clicking either of these elements, how do I detect in PHP which element was used to submit the form?
You don't.
Try this:
<html>
<body>
<?
// received?
if (isset($_POST["myAction"])) {
echo $_POST["myAction"]." clicked!";
}
?>
<br>
<form name="example" method="post" action="test.ph p">
<input type=submit name="myAction" value="ADD">
<input type=submit name="myAction" value="EDIT">
<input type=submit name="myAction" value="MODIFY">
</form>
</body>
</html> TIA,
You're welcome Marc
Regards,
Erwin Moller
why have you named the submit button "add"? sounds more like an
action.
how bout naming it a nice generic "submit"
<form name="myForm" method="post">
<INPUT type="hidden" name="action" value="edit">de fault action = edit
<input type="submit" name="submit">
<a href="#" onClick="docume nt.myForm.actio n.value='edit';
document.myForm .submit();">edi t</a>
<a href="#" onClick="docume nt.myForm.actio n.value='modify ';
document.myForm .submit();">mod ify</a> me**********@ya hoo.com (Marc) wrote in message news:<ac******* *************** ****@posting.go ogle.com>... Hello,
I have a self - submitting form with multiple submits and I want to detect after the submit which button is pressed.
Code example: <form name="example" method="post" action="/test.php"> <input type =submit name="add"> form elements but also
<a href="#" onClick=documen t.myForm.submit ()>edit</a> <a href="#" onClick=documen t.myForm.submit ()>modify</a>
</form>
If I submit the form by clicking either of these elements, how do I detect in PHP which element was used to submit the form?
TIA,
Marc bk***********@y ahoo.com (Brad Kent) wrote in message news:<7a******* *************** ****@posting.go ogle.com>... why have you named the submit button "add"? sounds more like an action. how bout naming it a nice generic "submit"
<form name="myForm" method="post"> <INPUT type="hidden" name="action" value="edit">de fault action = edit <input type="submit" name="submit">
<a href="#" onClick="docume nt.myForm.actio n.value='edit'; document.myForm .submit();">edi t</a> <a href="#" onClick="docume nt.myForm.actio n.value='modify '; document.myForm .submit();">mod ify</a> me**********@ya hoo.com (Marc) wrote in message news:<ac******* *************** ****@posting.go ogle.com>... Hello,
I have a self - submitting form with multiple submits and I want to detect after the submit which button is pressed.
Code example: <form name="example" method="post" action="/test.php"> <input type =submit name="add"> form elements but also
<a href="#" onClick=documen t.myForm.submit ()>edit</a> <a href="#" onClick=documen t.myForm.submit ()>modify</a>
</form>
If I submit the form by clicking either of these elements, how do I detect in PHP which element was used to submit the form?
TIA,
Marc
Thanks Brad, this is what I was looking for!
Marc me**********@ya hoo.com (Marc) wrote in message news:<ac******* *************** ****@posting.go ogle.com>... bk***********@y ahoo.com (Brad Kent) wrote in message news:<7a******* *************** ****@posting.go ogle.com>... why have you named the submit button "add"? sounds more like an action. how bout naming it a nice generic "submit"
<form name="myForm" method="post"> <INPUT type="hidden" name="action" value="edit">de fault action = edit <input type="submit" name="submit">
<a href="#" onClick="docume nt.myForm.actio n.value='edit'; document.myForm .submit();">edi t</a> <a href="#" onClick="docume nt.myForm.actio n.value='modify '; document.myForm .submit();">mod ify</a> me**********@ya hoo.com (Marc) wrote in message news:<ac******* *************** ****@posting.go ogle.com>... Hello,
I have a self - submitting form with multiple submits and I want to detect after the submit which button is pressed.
Code example: <form name="example" method="post" action="/test.php"> <input type =submit name="add"> form elements but also
<a href="#" onClick=documen t.myForm.submit ()>edit</a> <a href="#" onClick=documen t.myForm.submit ()>modify</a>
</form>
If I submit the form by clicking either of these elements, how do I detect in PHP which element was used to submit the form?
TIA,
Marc
Hmmm.. Now I get
document.myForm .submit() is not a function in the JavaScript console of Netscape...
Used to work....
????
Marc
sorry.. I'm real slow to get back to this thread...
netscape doesn't like the submit button being named "submit"
it gets confused with "document.myFor m.submit();"
better late than never? me**********@ya hoo.com (Marc) wrote in message news:<ac******* *************** ****@posting.go ogle.com>... me**********@ya hoo.com (Marc) wrote in message news:<ac******* *************** ****@posting.go ogle.com>... bk***********@y ahoo.com (Brad Kent) wrote in message news:<7a******* *************** ****@posting.go ogle.com>... why have you named the submit button "add"? sounds more like an action. how bout naming it a nice generic "submit"
<form name="myForm" method="post"> <INPUT type="hidden" name="action" value="edit">de fault action = edit <input type="submit" name="submit">
<a href="#" onClick="docume nt.myForm.actio n.value='edit'; document.myForm .submit();">edi t</a> <a href="#" onClick="docume nt.myForm.actio n.value='modify '; document.myForm .submit();">mod ify</a> me**********@ya hoo.com (Marc) wrote in message news:<ac******* *************** ****@posting.go ogle.com>... > Hello, > > I have a self - submitting form with multiple submits and I want to > detect after the submit which button is pressed. > > Code example: > <form name="example" method="post" action="/test.php"> > <input type =submit name="add"> form elements but also > > <a href="#" onClick=documen t.myForm.submit ()>edit</a> > <a href="#" onClick=documen t.myForm.submit ()>modify</a> > > </form> > > If I submit the form by clicking either of these elements, how do I > detect in PHP which element was used to submit the form? > > TIA, > > Marc
Hmmm.. Now I get
document.myForm .submit() is not a function in the JavaScript console of Netscape...
Used to work.... ????
Marc This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Randell D. |
last post by:
Folks,
I am working on a contact db using PHP and MySQL. My results so far outputs
a slimed down version of records to the browser. I would like to implement
a method whereby the user can click on a text link which will then show the
full record. I don't want to have hyperlinks with values incorporated in
the link (thus, I don't want to have http://www.example.com?abc=1234) - I
prefer to use a POST method thus what I would like to do...
|
by: Forti2ude |
last post by:
Hello,
I have a simple form...
<form>
<select name="foo" multiple>
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</select>
|
by: Aaron C |
last post by:
I'm validating a form that has two buttons ("Next" and "Back"). The call
to the script is currently in the form's onSubmit() handler. Upon
pressing either button, the script runs. This is understandable, since
either button press is considered a submit. Is there a way to test which
button was pressed to determine whether or not to run the script?
Thanks,
Aaron
P.S. I've already tried attaching the same script to the "Next" button's
|
by: Red |
last post by:
Hi,
I'm not very familiar with Javascript. I usually leave that kind of
stuff up to Dreamweaver, but i'm starting to need a little more than it
can offer.
I have an asp page which creates a form from a record set. Very simply
it lists items that can be ordered by the customer. The customer simply
enters the required qty for each item and hits submit:
|
by: Philippe C. Martin |
last post by:
Hi,
I am trying to change the data in a form field from python. The following
code does not crash but has no effect as if "form" is just a copy of the
original html form.
Must I recreate the form order to do that ?
My point is for the client to be able to re-read the modified data.
| |
by: RobR |
last post by:
We have a customer using our application that has a problem.
Within our app, we have a two different forms (one generates
an email, the other a fax via a webservice). When they click the
submit button, IE6 is generating the event 6 times!!! So they
end up sending 6 faxes or 6 emails. We simply cannot reproduce
this. We can't find anything wrong in our code that might cause
this, I can't find anything in MS Technet about IE bugs that...
|
by: Plater |
last post by:
I'm going to stab myself in the face.
I have a page with a single form.
Regular old html.
There are a few checkboxes and textboxes and and two submit buttons (I hope that's not the issue...)
The form submits to itself (I control the backend so I handle it)
When I click the submit button, the form is submitted and I get my page back with a "form submitted" text in a certain place.
As SOON as it finishes loading, it automatically submits...
|
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...
|
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,...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |