Manu Baby
Manu Baby

Reputation: 9

Dynamic datepicker

            <?php 

                $str1='';
                $y=0;
                $i=0;

                foreach($attachments->result() as $row)
                {
                    $y=$i+1;
                    $str1.='<td align="center"><input type=text name=attachmentdate id=attachmentdate ></td>';
                    $i++;
                }
                echo $str1;
            ?>

I used this code for dynamically populating datepicker. But only the first textbox is showing date.

Upvotes: 0

Views: 105

Answers (2)

Dave Cooper
Dave Cooper

Reputation: 10714

As standards state (http://dev.w3.org/html5/html-author/#attributes), your attributes must be surrounded in quote (as Manwal has indicated).

$str1.='<td align="center"><input type="text" name="attachment-date" id="attachment-date" ></td>';

I've also added in some hyphens to make the attributes more readable

Just as a side-note, it looks like you might not actually need your $y or $i variables, as they don't seem to be used.

I have tested your code with the quotes added and can confirm it works as I believe you are intending it to.

Hope that helps.

Upvotes: 2

Manwal
Manwal

Reputation: 23816

Try adding double quotes:

$str1 .='<td align="center"><input type="text" name="attachmentdate" id="attachmentdate" ></td>';
                                        ^    ^      ^              ^    ^              ^

Upvotes: 0

Related Questions