Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GET and POST method problem, key array changes

Status
Not open for further replies.

sc7090

Technical User
Oct 28, 2003
21
0
0
IT
Hallo to everybody,
my problem is very simple: if i write:

<input name="F2070.1" type="hidden" value="12" />
<input name="name" type="hidden" value="F2070.1" />

the print_r result for $_GET and $_POST array is:

Array ( [F2070_1] => 12 [name] => F2070.1 )

So, what happend to the key F2070.1?? I use php module and Apache version is 2.0.43

Any idea? thanks in advance for your interest.

Claudio.

---

I wrongly post this message to apache group and i was suggested to look in this forum: the only solution i found was to use urlencode() but it doesn't work.

Thanks,

Claudio.
 
In PHP dot (.) is used as concatenation operator and as such cannot be used in variables. PHP would interpret that as F2070 & 1 and get confused. That is why dots in input names get automagically transformed into underscore. Other than that, your script is behaving normally.
 
You are right! I thought that the key of an array was seen as a string or a value.
But why do i need to do that? The answer is that i create a mySQL
query where the <name> is what i look for and the value is what i set.
the query looks like:

UPDATE table SET val=<value> WHERE cod=<name>

Well, if someone else has the same problem i made this:

<input name="<somename>" value="name_//_key">
<input name="key" value="<value>">

_//_ is a separator but can be anything else;
key is a string of 5 chars that rappresent a number (00001, 00012, etc...)

with string functions i separate the name from the key: with
the key i can find the value associated with the name. Using
post method i would have:

$_POST[<somename>]=>name_//_key
$_POST[<key>]=>value

That's all.

Merry Christmas to everybody.

Claudio.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top