Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » PHP

getting all the input elements of a malformed form tag

 
Jump to:  
 
yawnmoth
PostPosted: Wed Sep 03, 2008 6:05 am    Post subject: getting all the input elements of a malformed form tag
       
I'm trying to get a list of all the input elements of a form tag and
am having some difficulty doing so. First, here's my XHTML:

<div>
<form action="">
<input type="text" name="a" />
</div>
<div>
<input type="text" name="b" />
</div>
<div>
<input type="submit" />
</form>
</div>

It isn't semantically correct XHTML but that doesn't stop web
developers from coding like that.

Anyway, in both Firefox and IE, if you visit a webpage containing the
above, and hit the Submit button, the resultant URL will have both a
and b defined via GET.

I'd like to be able to get a list of the same input parameters that
the browser does for a given form element. I had been using "//
form[1]//input" as an XPath query, but that doesn't work, here,
because not all of the inputs are children of the form element.
Indeed, if I use DOMDocument::saveHTML(), I get something more like
this:

<div>
<form action="">
<input type="text" name="a" />
</form>
</div>
<div>
<input type="text" name="b" />
</div>
<div>
<input type="submit" />
</div>

Any ideas?
 

 
Geoff Berrow
PostPosted: Wed Sep 03, 2008 6:30 am    Post subject: Re: getting all the input elements of a malformed form tag
       
Message-ID:
<aa5a9385-8a0a-49a0-b2e8-30eb442fb4b0@w7g2000hsa.googlegroups.com> from
yawnmoth contained the following:

Quote:
I'd like to be able to get a list of the same input parameters that
the browser does for a given form element. I had been using "//
form[1]//input" as an XPath query, but that doesn't work, here,
because not all of the inputs are children of the form element.
Indeed, if I use DOMDocument::saveHTML(), I get something more like
this:

Wrong froup methinks.
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
LINK - LINK
 

 
Gordon
PostPosted: Wed Sep 03, 2008 8:09 am    Post subject: Re: getting all the input elements of a malformed form tag
       
On Sep 3, 7:05 am, yawnmoth <terra1...@yahoo.com> wrote:
Quote:
I'm trying to get a list of all the input elements of a form tag and
am having some difficulty doing so. First, here's my XHTML:

div
form action=""
input type="text" name="a" /
/div
div
input type="text" name="b" /
/div
div
input type="submit" /
/form
/div

It isn't semantically correct XHTML but that doesn't stop web
developers from coding like that.

Anyway, in both Firefox and IE, if you visit a webpage containing the
above, and hit the Submit button, the resultant URL will have both a
and b defined via GET.

I'd like to be able to get a list of the same input parameters that
the browser does for a given form element. I had been using "//
form[1]//input" as an XPath query, but that doesn't work, here,
because not all of the inputs are children of the form element.
Indeed, if I use DOMDocument::saveHTML(), I get something more like
this:

div
form action=""
input type="text" name="a" /
/form
/div
div
input type="text" name="b" /
/div
div
input type="submit" /
/div

Any ideas?

I'm not sure what you're trying to achieve here I'm afraid, but I do
have one piece of advice for you. Fix your HTML. There is no reason
whatsoever for it not to be well formed, and it's only ever going to
cause you grief. If you didn't write teh HTML in question then have a
quiet polite word with whomever did.
 

 
Gordon
PostPosted: Wed Sep 03, 2008 8:10 am    Post subject: Re: getting all the input elements of a malformed form tag
       
On Sep 3, 7:05 am, yawnmoth <terra1...@yahoo.com> wrote:
Quote:
I'm trying to get a list of all the input elements of a form tag and
am having some difficulty doing so. First, here's my XHTML:

div
form action=""
input type="text" name="a" /
/div
div
input type="text" name="b" /
/div
div
input type="submit" /
/form
/div

It isn't semantically correct XHTML but that doesn't stop web
developers from coding like that.

Anyway, in both Firefox and IE, if you visit a webpage containing the
above, and hit the Submit button, the resultant URL will have both a
and b defined via GET.

I'd like to be able to get a list of the same input parameters that
the browser does for a given form element. I had been using "//
form[1]//input" as an XPath query, but that doesn't work, here,
because not all of the inputs are children of the form element.
Indeed, if I use DOMDocument::saveHTML(), I get something more like
this:

div
form action=""
input type="text" name="a" /
/form
/div
div
input type="text" name="b" /
/div
div
input type="submit" /
/div

Any ideas?

Oh, something else just occurred to me after I made that previous
post. Why not just use the contents of $_GET?
 

 
macca
PostPosted: Wed Sep 03, 2008 11:47 am    Post subject: Re: getting all the input elements of a malformed form tag
       
the variables are in the $_GET array.
 

 
yawnmoth
PostPosted: Wed Sep 03, 2008 12:41 pm    Post subject: Re: getting all the input elements of a malformed form tag
       
On Sep 3, 3:10 am, Gordon <gordon.mc...@ntlworld.com> wrote:
Quote:
On Sep 3, 7:05 am,yawnmoth<terra1...@yahoo.com> wrote:



I'm trying to get a list of all the input elements of a form tag and
am having some difficulty doing so. First, here's my XHTML:

div
form action=""
input type="text" name="a" /
/div
div
input type="text" name="b" /
/div
div
input type="submit" /
/form
/div

It isn't semantically correct XHTML but that doesn't stop web
developers from coding like that.

Anyway, in both Firefox and IE, if you visit a webpage containing the
above, and hit the Submit button, the resultant URL will have both a
and b defined via GET.

I'd like to be able to get a list of the same input parameters that
the browser does for a given form element. I had been using "//
form[1]//input" as an XPath query, but that doesn't work, here,
because not all of the inputs are children of the form element.
Indeed, if I use DOMDocument::saveHTML(), I get something more like
this:

div
form action=""
input type="text" name="a" /
/form
/div
div
input type="text" name="b" /
/div
div
input type="submit" /
/div

Any ideas?

Oh, something else just occurred to me after I made that previous
post. Why not just use the contents of $_GET?

I'm using cURL to grab the contents of the webpage and
DOMDocument::loadHTML() to parse the contents. Although I'd certainly
like to send a request via GET, it's getting all the variables that
I'd need to do so that's the hard part.
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

Zarys historii literatury albańskiej Prawo mieszkaniowe Targus FII 15.4? Hard Shell - sztywna torba do not gry i zabawy przedłużanie włosów