note 58519 deleted from faq.html by mazzanet
| From: | mazzanet@php.net | Date: | Wed, 23 Nov 2005 09:08:39 +0000 |
| Subject: | note 58519 deleted from faq.html by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-98962@lists.php.net to get a copy of this message | ||
Note Submitter: andy at arakka dot co dot th
----
Sorry if this is obvious, but I needed an array of values input from a form, and I did it with
variable names and PHP's '$$' feature. My form's PHP code reads like this:
for ( $LINENUMBER = 1;
$LINENUMBER <= $LINE_LIMIT;
$LINENUMBER = $LINENUMBER + 1 )
{
echo "<tr>\n";
echo "<td nowrap>$LINENUMBER</td>\n";
$SUPPLYIDENT = 'SUPPLYIDENT_' . $LINENUMBER ;
$QUANTITY = 'QUANTITY_' . $LINENUMBER ;
echo "<td><input\n";
echo "name='$SUPPLYIDENT'\n";
echo "type='TEXT'\n";
echo "maxlength='$IdentLength'\n";
echo "value='";
echo $$SUPPLYIDENT ;
echo "'\n";
echo " /></td>\n";
echo "<td><input\n";
echo "name='$QUANTITY'\n";
echo "type='TEXT'\n";
echo "maxlength='$IdentLength'\n";
echo "value='";
echo $$QUANTITY;
echo "'\n";
echo " /></td>\n";
echo "</tr>\n";
}
Decoding is similar:
for ( $P_LINENUMBER = 1;
$P_LINENUMBER <= $LINE_LIMIT
&& $ErrorMessage == "";
$P_LINENUMBER = $P_LINENUMBER + 1 )
{
$P_SUPPLYIDENT = 'P_SUPPLYIDENT_' . $P_LINENUMBER ;
$P_QUANTITY = 'P_QUANTITY_' . $P_LINENUMBER ;
if ( $$P_QUANTITY != "" )
{
...
}
}
From the other postings, it appears that this is valid XHTML and valid HTML4 and does not reveal
that your code is PHP.