how to assign new names for html input element at run time

1 replies
please i need help on how to assign new names for html input element at run time, i have not tried it but i know it will not work please any idea?

<?php
$x=1;

while( $x < 5)
{
echo "NOW YOU WILL UNDERSTAND WHAT I MEAN";
echo "<br/>";
echo '<input type = "checkbox" name = <?php $x ?>/>'.$x;
echo "<br/>";
echo '<input type = "checkbox" name = <?php $x ?>/>'.$x;

echo "<br/>";
echo '<input type = "checkbox" name = <?php $x ?>/>'.$x;
echo "<br/>";

$x++;
}

?>
#assign #element #html #input #names #run #time
  • Profile picture of the author Delta90
    Do you only need to assign it as the page is initialized or does it need to change from user input ? As it looks now it's just needed for the initialization and then what you've done should work, except why do you use the end and start tags <?php ?> in the middle of the script? You haven't stopped using php just because you are echoing html code.
    This is probably what you'd want.

    echo '<input type = "checkbox" name = "'.$x.'">'.$x;
    {{ DiscussionBoard.errors[8667452].message }}

Trending Topics