Jump to content

Dynamically execute an exec() based on number of results in an array.


CBR

Recommended Posts

I have an array that has 1-100 values depending on the amount of results that are selected in a multiple form box which then created an array. I am able to display each array by echoing $array[0]-[whatever]. What I have done is then counted the array for the number of results using the following code.

 

$tcount = count($toBox3);
echo "$tcount";

 

Simple enough there but now I am stumped.

 

I need for each array, run an exec command but I need it to stop at the end of the last array. It need to be dynamically done so if they select 10 results, or 100 results it builds the code needed and executes that number of time and also counts 1-whatever. So is there a way of doing this?

 

Hope this makes sense. I will include an example of what I am attempting but with an echo statement.

 

if ( $toBox[0] != "" )
  { 

    echo "$array[0]<br>";

  }

elseif ( $array[1] != "" )
  { 

    echo "$array[1]<br>";

  }

elseif ( $array[2] != "" )
  { 

    echo "$array[2]<br>";

  }

 

Thanks in advance for any help.

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.