PHP - Retrieve html tags based on id

Hi guys,

I was wondering if there is a way to retrieve html tag by suppling its id or name attribute? For eg. I have a textbox with ‘ferrari’ as its id. So whenever someone clicks on the textbox, its id will be submitted and the corresponding html tag ie. ‘<input type=“text”>’ will be returned. Any idea how this can be achieved? Thanks in advance.