Posted by Johnny on 09/03/06 23:07
"Jon Pike" <anonomoose@spamless.com> wrote in message
news:Xns98328FDADB1E5IDToken@24.70.95.211...
> if test.php is this file:
>
>
> <?php
> $lang = $_POST["lang"];
> print $lang;
> ?>
>
>
>
> <form method=post action=test.php>
> <input type=image src=engFlag.jpg name="lang" value=en>
> <input type=image src=fraFlag.jpg name="lang" value=fr>
> </form>
>
>
>
> Why won't it print $lang; after having one of the images clicked?
>
When stuff like this happens use
var_dump($_POST);
to see what is happening.
The behavior is different in IE and FF and probaby others too.
In IE it posts the location of the mouse click as lang_x and lang_y which
leaves $_POST['lang'] emptier than you'd like. OTOH if you do
$lang=$_POST['lang_x']; you'll find the x loc of the mouse click in $lang
In FF it posts the x and y coords and a 'lang' value so your code actually
works in FF but not IE.
It seems that neither browser conforms to HTML4 which seems to use a
lang.x and lang.y form here
http://www.w3.org/TR/html4/interact/forms.html#h-17.4.1
and that's what they show in here also
http://www.htmlhelp.com/reference/html40/forms/input.html
but sadly the browsers do what they do.
/*no comment*/
Navigation:
[Reply to this message]
|