php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16096 Gettype reports var as string; echo complains as array and it is an array
Submitted: 2002-03-15 07:52 UTC Modified: 2002-06-19 01:00 UTC
Votes:3
Avg. Score:2.7 ± 1.2
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: nico at vddi dot co dot za Assigned:
Status: No Feedback Package: Arrays related
PHP Version: 4.0.6 OS: Linux 2.3 (Suse 7.0)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nico at vddi dot co dot za
New email:
PHP Version: OS:

 

 [2002-03-15 07:52 UTC] nico at vddi dot co dot za
Below some code.

The array PM_method is setup as a HTML form that is fed to the next stage where $act = 1.

Note that gettype reports it as a string and echo can't print it because it is an array.

Regards

Nico
nico@vddi.co.za


<?php

#phpinfo();

if ($act == 1){


echo "Print Vars <p>";

$TT = gettype($var);


while (list($var, $value) = each($HTTP_POST_VARS)) {

$TT = gettype($var);

#echo "TTT $TT XX $var YY $PM_method[2] bb <p>";
echo "Gettype sees \$$var as a $TT<p>";
echo "Echo sees \$$var as an array $PM_method<p>";

        
echo "POST $var = $value<br>\n";
		
    		} # end while


} # end if ($act == 1)




if ($act == 0 || empty($act)){

?>

<form action="<?php echo $PHP_SELF ?>" method="post" name="form">

<table><tr><td style="text-align: right;">Bank Transfer:</td><td> <input type="checkbox" name="PM_method[2]" value="2" checked></td>
<td style="text-align: right;">Cash:</td><td> <input type="checkbox" name="PM_method[1]" value="1" checked></td>
<td style="text-align: right;">Cheque:</td><td> <input type="checkbox" name="PM_method[3]" value="3" checked></td>
<td style="text-align: right;">Company Order:</td><td> <input type="checkbox" name="PM_method[10]" value="10" checked></td>
</tr>

<tr>
<td style="text-align: right;">Voucher:</td><td> <input type="checkbox" name="PM_method[9]" value="9"></td>
<td style="text-align: right;">American Express:</td><td> <input type="checkbox" name="PM_method[4]" value="4"></td>
<td style="text-align: right;">Diners Club:</td><td> <input type="checkbox" name="PM_method[5]" value="5"></td>
<td style="text-align: right;">Eurocard:</td><td> <input type="checkbox" name="PM_method[8]" value="8"></td>
</tr>

<tr>
<td style="text-align: right;">Master Card:</td><td> <input type="checkbox" name="PM_method[7]" value="7"></td>
<td style="text-align: right;">VISA:</td><td> <input type="checkbox" name="PM_method[6]" value="6"></td>
</tr>
</table>

<input type="hidden" name="act" value="1">
<input type="submit" name="Submit" class="button" value="Register Supplier">
<input type="Reset" class="button"></div>
</FORM>

<?php 

;} # end if ($act == 0 || empty($act)

?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-17 12:43 UTC] sander@php.net
Can't reproduce with latest CVS. Can you try a snapshot from snaps.php.net?
 [2002-06-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 08 21:01:27 2024 UTC