Jump to content

Use php inside divID


Bogey

Recommended Posts

Hi all, Is something like this possible?

$a=1;while (blablabla)){<DIV id='idname_<?php echo $a;?>'></DIV>$a++;}

This is what I want, but cant get it done :S

Edited by Bogey
Link to comment
Share on other sites

Yes, that is what I am doing in the first post though? php echo is between <?php AND ?> I want my div id's made when page loads (number of divs are different on different times, so I don't know how many divs will apear)In each div is a button which can be clicked,but after click, that certain div needs to reload Hope I make myself clear a bit ;)

Link to comment
Share on other sites

or do I need to echo that part inside the php, something like this:

<?php$a=1;while (blabla){echo "<DIV id='item_" , $a . "'>";echo "</DIV>";}$a++;

Edited by Bogey
Link to comment
Share on other sites

I though PHP was a little more advanced
The "<" character is a less-than operator in PHP, it's not going to auto-detect HTML markup embedded in PHP code and assume you want to output that. It's up to you to tell it what to output. You can also do this:
$a=1;while (blablabla)){?><DIV id='idname_<?php echo $a;?>'></DIV><?php$a++;}

Link to comment
Share on other sites

Your last post was I thought how I had it.... and did not work... Now I see I missed some <?php and ?>, maybe that was the issue.... I go look at that one next time.... now I need to sleep, eyes falling down and a busy day at work tomorrow :( hahaha thnx again anyway...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...