mark110384 Posted November 10, 2008 Share Posted November 10, 2008 Is it possible to a assisgn a PHP varable to a DIV ID? For example <div id="<? echo "$div_id"; ?>" > But that doesn't work. Thanks Link to comment https://forums.phpfreaks.com/topic/132151-setting-a-div-id-to-a-php-variable/ Share on other sites More sharing options...
bobbinsbro Posted November 10, 2008 Share Posted November 10, 2008 try: <div id="<? echo $div_id; ?>" > (no need to use quotes). also make sure you have short tags enabled. Link to comment https://forums.phpfreaks.com/topic/132151-setting-a-div-id-to-a-php-variable/#findComment-686793 Share on other sites More sharing options...
premiso Posted November 10, 2008 Share Posted November 10, 2008 It is possible I would try this: <?php $div_id = "test"; ?> <div id="<?php echo $div_id; ?>" > This should output on the view source: <div id="test"> I think that is what you were asking. Link to comment https://forums.phpfreaks.com/topic/132151-setting-a-div-id-to-a-php-variable/#findComment-686794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.