Jump to content

[SOLVED] looping help


dennismonsewicz

Recommended Posts

code:

$status_array = array('Pending', 'Followup', 'Approved', 'Completed', 'Rejected', 'Correction');
	for($i = 0; $i > sizeof($status_array); $i++) {
		foreach($status_array as $arr) {
			$option = '<option name=' . $arr . ' value=' . $arr . '>' . $arr . '</option>';
		}
}

 

I have a select that I am trying to echo out the options for by looping through the array... but when I echo out $options I get nothing... any ideas?

Link to comment
https://forums.phpfreaks.com/topic/151843-solved-looping-help/
Share on other sites

You need to use double quotes for $option:

 

            $option = "'$arr";

 

I think you're using too many loops as well...

 

$status_array = array('Pending', 'Followup', 'Approved', 'Completed', 'Rejected', 'Correction');
   foreach($status_array as $arr)
       $option .= "$arr";

Link to comment
https://forums.phpfreaks.com/topic/151843-solved-looping-help/#findComment-797348
Share on other sites

Just got back to this forum didn't know this post would bring forth such a discussion HAHA. yeah I work in an evironment of open source guys and .NET guys and we battle ALL the time. YAY for open source!

 

Tks for the help guys... I thought about it on the drive home tonight and yeah I only need the one loop. I don't know what I was thinking

Link to comment
https://forums.phpfreaks.com/topic/151843-solved-looping-help/#findComment-797462
Share on other sites

Just got back to this forum didn't know this post would bring forth such a discussion HAHA. yeah I work in an evironment of open source guys and .NET guys and we battle ALL the time. YAY for open source!

 

Tks for the help guys... I thought about it on the drive home tonight and yeah I only need the one loop. I don't know what I was thinking

 

Haha yeah, gotta love the open vs closed source battles.

Link to comment
https://forums.phpfreaks.com/topic/151843-solved-looping-help/#findComment-797467
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.