note 48634 added to language.variables.external

From: Date: Sun, 02 Jan 2005 20:33:23 +0000
Subject: note 48634 added to language.variables.external
Groups: php.notes 
Request: Send a blank email to php-notes+get-82616@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/language.variables.external.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48634 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48634&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48634&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48634&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48634&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48634&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48634&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48634&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#82616) next »