473,385 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Getting the form id

Hi:

If you set the id attribute of a form, how do you access the id's
value from the script handling the post submission?

Cheers,
Aeden
Jul 17 '05 #1
4 1776
On 18 May 2004 13:38:18 -0700, be**********@hotmail.com (beveled edges) wrote:
If you set the id attribute of a form, how do you access the id's
value from the script handling the post submission?


You can't; the id attribute is not submitted.

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #2
Is it possible to retrieve the value of the name attribute of a form through
$_POST, or some other variable, from script the handles submission?

Cheers,
Aeden

"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:94********************************@4ax.com...
On 18 May 2004 13:38:18 -0700, be**********@hotmail.com (beveled edges) wrote:
If you set the id attribute of a form, how do you access the id's
value from the script handling the post submission?


You can't; the id attribute is not submitted.

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space

Jul 17 '05 #3
Aeden Jameson wrote:
Is it possible to retrieve the value of the name attribute of a form
through $_POST, or some other variable, from script the handles
submission?

Cheers,
Aeden


IIRC no, there is no way directly, since that is not submitted.

You would get much better answers if you really asked the _real
question_. What is it that you are trying to do ?

I'll throw a wild guess: You have several different forms on a single
page that all submit to the same .php file through POST, and you want to
know which form was used.

One way would be to use GET with POST to determine the used form:

<form name="form1" method="post" action="myscript.php?from=form1">

and for the second form:

<form name="form1" method="post" action="myscript.php?from=form2">

This way you can differentiate between the forms in the handling script
using $_GET["from"];

Another way of doing the same is by adding a hidden form field to each
form:

<input type="hidden" name="from" value="form1">

and

<input type="hidden" name="from" value="form1">

If it is something else you are trying to do, please let us know.

HTH

--
Suni

Jul 17 '05 #4
In article <40**********************@news.song.fi>,
"Juha Suni" <ju*******@ilmiantajat.fi> wrote:
I'll throw a wild guess: You have several different forms on a single
page that all submit to the same .php file through POST, and you want to
know which form was used.

One way would be to use GET with POST to determine the used form:

<form name="form1" method="post" action="myscript.php?from=form1">

and for the second form:

<form name="form1" method="post" action="myscript.php?from=form2">

This way you can differentiate between the forms in the handling script
using $_GET["from"];

Another way of doing the same is by adding a hidden form field to each
form:

<input type="hidden" name="from" value="form1">

and

<input type="hidden" name="from" value="form1">


For what it's worth, different <input type="submit" /> buttons, like
this, also works:

<form action="myscript.php" method="post">
<input type="submit" name="form1" value="click me" />
</form>

<form action="myscript.php" method="post">
<input type="submit" name="form2" value="click me" />
</form>

And you can also do this with different buttons in the same form.

JPK

--
Sorry, <de*****@cauce.org> is een "spam trap".
E-mail adres is <jpk"at"akamail.com>, waarbij "at" = @.
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gerry Abbott | last post by:
Hi all. Im using abbreviated field names on a form to optimise space, but would like to display for example, the status bar text of the control, onto the form header, when the control has the...
5
by: Thelma Lubkin | last post by:
I have a form/subform with the common one-to-many relationship. The form allows user to display records and move to other records via the selector, to add,delete, and edit them, with the related...
1
by: neeraj | last post by:
Hi people's I developed one MDI application with one MDI form and 2 child forms, form. Border style of first child forms set as Fixed3D and Window State set as normal (like dialog Box) and...
1
by: sparks | last post by:
I have a form/table with an autoid it is linked to a table/form with and ID as a 1 to many. Under this form/table I need another table with many records for each on of the many in the previous...
2
by: FunkHouse9 | last post by:
I have 2 functions, the first one, "GetSelectedItem" is determining which radio button was selected and running the "formvalidation" function if needed. This is working fine. My problem is getting...
2
by: srusskinyon | last post by:
I need some help getting unique records from our database! I work for a small non-profit homeless shelter. We keep track of guest information as well as what services we have offered for...
0
by: buntyindia | last post by:
Hi, I have a very strange problem with my application. I have developed it using Struts. I have a TextBox With Some fixed value in it and on Submit iam passing it to another page. <html:form...
2
DonRayner
by: DonRayner | last post by:
This one has me stumped. I'm getting a "Type Mismatch" error on one of my forms when it's being opened. It's hapening before the forms "On Open" event, I stuck a msgbox in there to check and I'm...
9
vikas251074
by: vikas251074 | last post by:
I am not getting date value in spite of my good effort. This code was working in my last office where I work. Now I am trying to work at my home pc. but not getting date value. Any can help me why...
7
vikas251074
by: vikas251074 | last post by:
I am getting error above in following code since few days giving tension day and night. How can I solve this? I am facing since Oct.25. in line no. 362 After doing a lot of homework, I am...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.