Connecting Tech Pros Worldwide Forums | Help | Site Map

What is wrong with "form"

Werner Partner
Guest
 
Posts: n/a
#1: Jul 24 '05
On my testpage

http://www.sonoptikon.de/test.php

I have this

<table><tr>

<td valign="top" align="center" style="width:150px;">
<form action=test.php method="get">
<input style="width:150px;" type="Submit" value="Provisionsentwicklung">
<input type="hidden" name="mode" value="pr"
</form>
</td>

<td valign="top" align="center" style="width:150px;">
<form action=test.php method="get">
<input style="width:150px;" type="Submit" value="IP-Entwicklung">
<input type="hidden" name="mode" value="ip"
</form>
</td>

</tr></table>

If I klick on any button, I get

"http://www.sonoptikon.de/test.php?mode=pr&mode=ip"

What is wrong?

Source text is:

print '
<td valign="top" align="center" style="width:150px;">
<form action=' . $HTTP_SERVER_VARS['PHP_SELF'] . ' method="get">
<input style="width:150px;" type="Submit" value="Provisionsentwicklung">
<input type="hidden" name="mode" value="pr"
</form>
</td>

<td valign="top" align="center" style="width:150px;">
<form action=' . $HTTP_SERVER_VARS['PHP_SELF'] . ' method="get">
<input style="width:150px;" type="Submit" value="IP-Entwicklung">
<input type="hidden" name="mode" value="ip"
</form>
</td>';

It works correct with mozilla, you can see this error only in IE

Thanks for help

Werner



--
--------------------------------------------------
Werner Partner, 45699 Herten
http://www.sonoptikon.de

Steve Pugh
Guest
 
Posts: n/a
#2: Jul 24 '05

re: What is wrong with "form"


Werner Partner <kairos@sonoptikon.de> wrote:
[color=blue]
>On my testpage
>
>http://www.sonoptikon.de/test.php
>
><form action=test.php method="get">
><input style="width:150px;" type="Submit" value="Provisionsentwicklung">
><input type="hidden" name="mode" value="pr"
></form>[/color]

The hidden input tag is missing the > at the end.
So the browser may treat
<input type="hidden" name="mode" value="pr"</form>
as one tag and hence doesn't close the first form.
[color=blue]
><form action=test.php method="get">
><input style="width:150px;" type="Submit" value="IP-Entwicklung">
><input type="hidden" name="mode" value="ip"
></form>[/color]

Again the form isn't closed but that's irrelevant now as you have no
more forms in the page.
[color=blue]
>If I klick on any button, I get
>
>"http://www.sonoptikon.de/test.php?mode=pr&mode=ip"
>
>What is wrong?[/color]

What you effectively have is:

<form action=test.php method="get">
<input style="width:150px;" type="Submit"
value="Provisionsentwicklung">
<input type="hidden" name="mode" value="pr">
<input style="width:150px;" type="Submit" value="IP-Entwicklung">
<input type="hidden" name="mode" value="ip">

and the submitted result is correct for that.
[color=blue]
>It works correct with mozilla, you can see this error only in IE[/color]

For once Mozilla's error correction is kinder to mistakes than IE's.

Running your code through the validator would have pointed out this
mistake (and some others).

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <steve@pugh.net> <http://steve.pugh.net/>
Werner Partner
Guest
 
Posts: n/a
#3: Jul 24 '05

re: What is wrong with "form"


Steve Pugh schrieb:
[color=blue]
> Werner Partner <kairos@sonoptikon.de> wrote:
>
>[color=green]
>>On my testpage
>>
>>http://www.sonoptikon.de/test.php
>>
>><form action=test.php method="get">
>><input style="width:150px;" type="Submit" value="Provisionsentwicklung">
>><input type="hidden" name="mode" value="pr"
>></form>[/color]
>
>
> The hidden input tag is missing the > at the end.
> So the browser may treat
> <input type="hidden" name="mode" value="pr"</form>
> as one tag and hence doesn't close the first form.[/color]

Uff - that happens when I am looking for "serious" mistake and not
seeing the simple mistakes

By the way - what about </input> ?

Thanks

Werner




--
--------------------------------------------------
Werner Partner, 45699 Herten
http://www.sonoptikon.de
Michael Winter
Guest
 
Posts: n/a
#4: Jul 24 '05

re: What is wrong with "form"


On 31/03/2005 11:37, Werner Partner wrote:

[snip]
[color=blue]
> By the way - what about </input> ?[/color]

INPUT elements are empty: they have no content so they don't need
closing tags. In fact, closing INPUT tags are forbidden in HTML.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Steve Pugh
Guest
 
Posts: n/a
#5: Jul 24 '05

re: What is wrong with "form"


Werner Partner <kairos@sonoptikon.de> wrote:
[color=blue]
>By the way - what about </input> ?[/color]

Allowed but not recommended in XHTML (though not allowed in
HTML-compatible XHTML). No such thing in HTML.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <steve@pugh.net> <http://steve.pugh.net/>
Harlan Messinger
Guest
 
Posts: n/a
#6: Jul 24 '05

re: What is wrong with "form"


Steve Pugh wrote:[color=blue]
> Werner Partner <kairos@sonoptikon.de> wrote:
>
>[color=green]
>>By the way - what about </input> ?[/color]
>
>
> Allowed but not recommended in XHTML[/color]

Not recommended, but the opening tag must end in /> otherwise.

(though not allowed in[color=blue]
> HTML-compatible XHTML). No such thing in HTML.
>
> Steve
>[/color]
Closed Thread