Accessing the id attribute of html element in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vivekjain
Forum Commoner
Posts: 76
Joined: Thu Jan 08, 2004 12:38 am

Accessing the id attribute of html element in PHP

Post by vivekjain »

Hi,
I would like to know if i can access the id attribute of html element in PHP. For eg <input type = button id = "bu">, i need to know if i can access the id from a PHP page, and if so how? thanks
markbeadle
Forum Commoner
Posts: 29
Joined: Tue Dec 02, 2003 2:50 am
Location: Aachen, Germany

Post by markbeadle »

As far as I know PHP builds the page (Server Side).

Only way of processing the id is to store necessary data for use later.

To access the information interactively using the ID you need to use client side information (i.e. Javascript).
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

i'm curious about this as well since name is decremented in form elements (input, textarea, etc) in html4.01 and unsupported in xhtml... yet php doesn't grab them
User avatar
phpcoder
Forum Contributor
Posts: 158
Joined: Sat Nov 02, 2002 1:18 pm
Location: Manchester, UK

Post by phpcoder »

What about sending id vale in hidden field :cry:
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

i think i'm off, or phpcoder is.

i was thinking attributed of elements... ie: element input
attributes name/id
eg: <input type="hidden" name="example" value="" id="example">
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

I don't understand the original point of this thread. Can you elaborate?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

m3rajk wrote:i'm curious about this as well since name is decremented in form elements (input, textarea, etc) in html4.01 and unsupported in xhtml... yet php doesn't grab them
Just checked the XHMTL reference on w3schools and it's got name supported in all XHTML doctypes including strict so I don't think it's going anywhere soon. The id is something different and should be unique for each element so if you have three radio buttons in a group they should have the same name but different id's.

Mac
Post Reply