Re: Problem with input name, how can i use . (dot) in a name of a input type text?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jochem Maas wrote:
Stut wrote:
Jônata Tyska Carvalho wrote:
Im having a big problem because the name of one input type text that is '
table.name' in my html, becomes 'table_name' in php, it is a kind of
bug??
=S

<form method="post">
<input type="text" name"table.name">
</form>

in PHP we have:

$_POST["table_name"] instead of $_POST["table.name"]

someone knows some way to put this to work?? i wanna send 'table.name'
and
receive in php 'table.name'!
I don't know for certain but that's likely happening because a period is
not valid in a PHP variable name. One alternative would be to use
table[name] instead. This will lead to $_POST['table']['name'].

I think Stut is correct - the period is a concatenation operator.
also there are plenty of alertnatives to the Stuts suggested 'table[name]' naming approach.

that said given the following code:

	$f = "my.bad";
	$$f = "MY BAD";
	echo $f, "\n", $$f, "\n";

... I personally feel that the $_POST should just contain
'table.name' - which is not an illegal array key - most likely the reason it is (the var name)
transformed is due to BC, namely with register_globals set to ON php is required to automatically
create a variable $table.name (which is not legal).

Indeed. I think technically this would be a bug because in an ideal world it would only be transformed when extract'ed from the array. There's no reason to transform it prematurely.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux