Jump to content

Simple echo question


smith.james0

Recommended Posts

Is code works fine like is

Units: <input type="text" name="<? echo $i; ?>[]" />

the array works fine

when the above examples are tested I just get a blank page. The only way to get it to output is to remove the []

<?php

echo "Sales <input type=\"text\" name=\"{$i}\">";

?>

But the array doesn't work

Thanks James
Link to comment
https://forums.phpfreaks.com/topic/30796-simple-echo-question/#findComment-142032
Share on other sites

I have this looped 14 times

<?php echo "$i      $disp_date"; ?> <input type="hidden"  value="<?php echo $time; ?>" name="<? echo $i; ?>[]"  />
Sales: <input type="text" name="<? echo $i; ?>" />
Units: <input type="text" name="<? echo $i; ?>[]" />
Extra :  <input type="text" name="<? echo $i; ?>[]" /><br>

So i get this informtion in the $_POST array

Array
(
    [1] => Array
        (
            [0] => 1165708800 (Hidden field)
            [1] => test1 (Sales)
            [2] => test2 (Units)
            [3] => test3 (Extra)
        )

    [2] => Array
        (
            [0] => 1165795200
            [1] =>
            [2] =>
            [3] =>
        )

    [3] => Array
        (
            [0] => 1165881600
            [1] =>
            [2] =>
            [3] =>
        )
etc..

The four bits of information in each array are put into a db


Thanks James
Link to comment
https://forums.phpfreaks.com/topic/30796-simple-echo-question/#findComment-142054
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.