PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
taly
Forum Newbie
Posts: 1 Joined: Thu Jan 21, 2010 3:25 am
Post
by taly » Thu Jan 21, 2010 3:36 am
In the script below I cannot figure out why my $test_array is gone after line 16
Please give me a hint to solve this problem
Code: Select all
<?php
$test_array = array(1,2,3,4);
// Here I can see the $test_array
echo '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="testing">';
// echo "<select name='test'>";
print_r($test_array); Display: Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 )
echo "<br>";
echo "<br>";
// Here I cannot see the $test_array
echo '<form method="post" action="'.$_SERVER['PHP_SELF'].'" name="testing">';
echo "<select name='test'>";
print_r($test_array); Display: Nothing
?>
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Thu Jan 21, 2010 3:41 am
Nothing? Are you sure it's not displayed in the source code? Considering your outputting it inside a <select> tag I doubt it would show up on screen.
If not, what does var_dump() say..