I have a form
<form name="jim" id="jim" .......... >
.........
</form>
How do I get either the name or id from the form in PHP ?
--
Rick
Digital Printing www.intelligence-direct.com - 01270 215550 7 41184
Rick wrote: I have a form
<form name="jim" id="jim" .......... > ........ </form>
How do I get either the name or id from the form in PHP ?
You don't, unless you add it as a hidden input or a get-variable.
<input type="hidden" name="formname" value="myform">
And just grab that from $_POST['formname'] in your script.
Roy W. Andersen
--
ra at broadpark dot no / http://roy.netgoth.org/
"Hey! What kind of party is this? There's no booze
and only one hooker!" - Bender, Futurama
*** Rick wrote/escribió (Thu, 13 Jan 2005 12:48:44 +0000): <form name="jim" id="jim" .......... > ........ </form>
How do I get either the name or id from the form in PHP ?
The names are the keys in the $_GET or $_POST array.
foreach($_POST as $key => $value){
echo "<li>$key: $value</li>";
}
--
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
--
Alvaro G Vicario wrote: *** Rick wrote/escribió (Thu, 13 Jan 2005 12:48:44 +0000): <form name="jim" id="jim" .......... > ........ </form>
How do I get either the name or id from the form in PHP ?
The names are the keys in the $_GET or $_POST array.
foreach($_POST as $key => $value){ echo "<li>$key: $value</li>"; }
Thats only for inputs contained within a form
--
Rick
Digital Printing www.intelligence-direct.com - 01270 215550
Roy W. Andersen wrote: Rick wrote: I have a form
<form name="jim" id="jim" .......... > ........ </form>
How do I get either the name or id from the form in PHP ?
You don't, unless you add it as a hidden input or a get-variable.
<input type="hidden" name="formname" value="myform">
And just grab that from $_POST['formname'] in your script.
Bugger, thats what I am doing at the moment, was hoping there was a better
way :/
--
Rick
Digital Printing www.intelligence-direct.com - 01270 215550
Rick wrote: Roy W. Andersen wrote:
<input type="hidden" name="formname" value="myform">
And just grab that from $_POST['formname'] in your script.
Bugger, thats what I am doing at the moment, was hoping there was a better way :/
Sending it as a POST with the rest of the form is pretty straight
forward and simple. If you're doing a foreach() loop on the $_POST array
on the serverside and don't want to do whatever you do to the form data
with that field, just issue an if/else or switch-statement to filter it
out. Either that, or you can start by grabbing the $_POST['formname']
followed by an unset($_POST['formname']) to avoid it carrying into the
code you got further down :)
Roy W. Andersen
--
ra at broadpark dot no / http://roy.netgoth.org/
"Hey! What kind of party is this? There's no booze
and only one hooker!" - Bender, Futurama
*** Rick wrote/escribió (Thu, 13 Jan 2005 13:00:55 +0000): Thats only for inputs contained within a form
You are right, I misunderstood you. The answer is: you cannot. That info is
not sent to the server. Just add an extra hidden field.
--
-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
--
.oO(Rick) Roy W. Andersen wrote:
You don't, unless you add it as a hidden input or a get-variable.
<input type="hidden" name="formname" value="myform">
And just grab that from $_POST['formname'] in your script.
Bugger, thats what I am doing at the moment, was hoping there was a better way :/
Nope. The name attribute for the form element is just there for
backwards compatibility (according to the spec, personally I've never
used it), so it's rather useless and not submitted to the server at all.
Micha This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Scott Navarre |
last post by:
Hello,
I have a javascript function that I want to read the name of the form
which is calling it.
Here is my HTML:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
|
by: Edward Lim |
last post by:
Hi guys,
is it possible to retrieve the name or the id of a form in an ASP.Net page?
In the code behind inside the page class, I would like to be able to
reference to that "form object" and to retrieve its name or id. is that at
all possible?
Cheers
|
by: Java script Dude |
last post by:
We just discovered another IE bug.
When an html form contains an element with a name of `name` IE's
internal index screws up the .name property of the containing form to
point to the bad element object instead of containing the string name
property of the form.
Here is the simplified test case:
<html>
|
by: Marc Elser |
last post by:
Hi Everybody,
Can someone please tell me how to access the form name if there's a form
field named "name", for example:
<form name="myform">
<input type="text" name="name" value="Marc">
<input type="button" onClick="alert(this.form.name);">
</form>
|
by: Jeff Baker |
last post by:
How does one post to an ASPX page using the WebClient when the form
name is required?
| |
by: ej |
last post by:
I'm not seeing how to get at the 'name' attribute of an HTML <form> element.
form = cgi.FieldStorage()
gives you a dictionary-like object that has keys for the various named
elements *within* the form...
I could easily replicate the form name in a hidden field, but there ought to
be some way to get directly at the form name but I'm just...
|
by: ashore |
last post by:
Folks, the snippet below errors out on both FF and IE, with FF's error
console complaining "this.form has no properties", while a reference to
"document.forms.name" works correctly.
<form name='whatever1' method = "post"
action="javascript:alert(this.form.name);">
<input type="button" value="click" onClick = "this.form.submit();"/>...
|
by: scripteaze |
last post by:
posting to a form with no form name or it's just that i cant find the
form name.
can anyone explain how to either post to a form with no name or, find
the name of the form..here my current output, but i dont see a form
name, also, there is only 1 form on the page
<POST https://somesite.com/login.html application/x-www-form-
urlencoded...
|
by: scripteaze |
last post by:
Im using mechanize method for retrieving the form so that i may log
into it. I need to find a way to get the form name. Its not listed
anywhere in the html source.The reason i need to do this is because im
tryin not to use the for loop below. Someone told me that the form
name should be listed in the 'print form' portion of the codes output....
|
by: franc sutherland |
last post by:
Hello,
I have a report which I filter using the me.filter command in the
OnOpen event.
Me.Filter = "OrderID=" & Forms!variable_form_name!
Me.FilterOn = True
I want to be able to open that report, filtered, from different
forms. How do I carry the name of the current form into the
|
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...
| |
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
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...
|
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.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |