note 48634 deleted from language.variables.external by danbrown
| From: | danbrown@php.net | Date: | Wed, 09 Mar 2011 14:40:14 +0000 |
| Subject: | note 48634 deleted from language.variables.external by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177705@lists.php.net to get a copy of this message | ||
Note Submitter: dreptack at op dot pl
----
I needed to post html form through image input element. But my problem was I had to use multiple
image-buttons, each one for a single row of form table. Pressing the button was mention to tell
script to delete this row from table and also (in the same request) save other data from the form
table.
I wrote simple test-script to see what variable I should check for in a script:
I have a html document:
<form action="test.php" method="post">
<input type="image" name="varscalar" src="/images/no.gif" />
<input type="image" name="vararray[12]" src="/images/no.gif" />
</form>
And a php script:
<?php
if ($_POST) {
echo "post: <pre>"; print_r($_POST); echo '</pre>';
}
?>
What I've discovered suprised me a lot.
After hitting on varscalar:
post:
Array
(
[varscalar_x] => 6
[varscalar_y] => 7
)
After hitting on upper right corner of vararray:
post:
Array
(
[vararray] => Array
(
[12] => 2
)
)
This mean when clicking on image-type input element, which name is an array, only y-part of a value
is remembered.
The result is the same on: php 4.1.2 on Win98se, php 4.3.9-1 on linux