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
dallasx
Forum Contributor
Posts: 106 Joined: Thu Oct 20, 2005 4:55 pm
Location: California
Post
by dallasx » Fri Oct 21, 2005 8:28 pm
Code: Select all
print_r($mens_sizes); //OUTPUT: Array ( [X-Small] => [Small] => [Medium] => 22 [Large] => 2 [X-Large] => 2 [XX-Large] => 2 [XXX-Large] => 2 )
echo "<br>";
while (list($key, $value) = each($mens_sizes))
{
echo "before: ".$value."<br>"; //OUTPUT:
if($value == NULL)
$value = 0;
echo "after: ".$value."<br>"; //OUTPUT: 0
print_r($mens_sizes); //OUTPUT: Same as before I traversed it.
echo "<br>";
}
print_r($mens_sizes); //OUTPUT: Same as before I traversed it.
How do I assign the value to 0 if there was a blank form field and make it stay in the array?
Last edited by
dallasx on Thu Nov 10, 2005 3:22 pm, edited 1 time in total.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Oct 21, 2005 9:45 pm
dallasx
Forum Contributor
Posts: 106 Joined: Thu Oct 20, 2005 4:55 pm
Location: California
Post
by dallasx » Sat Oct 22, 2005 11:14 am
Thanks, I appreciate it. I don't know why I didn't think of that.