Welcome Guest, Not a member yet? Register   Sign In
echo array of inputs
#1

[eluser]CocoMansur[/eluser]
Hi,

this is my code in HTML

Code:
<?php foreach($query2->result() as $row): ?>
<input type="hidden" name="outlays_id[]" value="<?php echo $row->id; ?>" />
<?php endforeach; ?>

i would like to display the values first using for loop

Code:
for($x=0; $x<count($this->input->post('outlays_id')); $x++)
echo $this->input->post("outlays_id[$x]");

the above code doesn't display anything...

but using foreach it displays the value of each array...

how can i make it display using for loop?

using CI 2.1.4
#2

[eluser]CocoMansur[/eluser]
Got it...

here is my code to display it with for loop

Code:
$test = $this->input->post('outlays_id');
for($x=0; $x<count($test); $x++){
   echo $test[$x];
}

anyway, is there a way to not pass it to a variable?




Theme © iAndrew 2016 - Forum software by © MyBB