Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 3rd Nov 2013, 06:19 AM   #1
Active Warrior
 
Join Date: 2010
Location: Malaysia
Posts: 36
Thanks: 14
Thanked 0 Times in 0 Posts
Default
how to assign new names for html input element at run time
Share on: 
fb share twitter share gplus share more share

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++;
}

?>
lloydblinks is offline  
Unread 3rd Nov 2013, 02:49 PM   #2
Active Warrior
War Room Member
 
Join Date: 2012
Posts: 46
Thanks: 9
Thanked 17 Times in 15 Posts
Default
Re: how to assign new names for html input element at run time
Share on: 
fb share twitter share gplus share more share

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;
Delta90 is offline  
The Following User Says Thank You to Delta90 For This Useful Post:
Closed Thread


Bookmarks

Tags
assign, element, html, input, names, run, time


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 04:54 AM.