dauzy Posted July 16, 2008 Share Posted July 16, 2008 Hello, I'm trying to calendar from a table and have the background change dynamically. The problem that I'm having is that I'm having trouble having the php code echo out a new table with the table data background take in a variable... Here's the code which probably help explain my problem. if(in_array($day_num, $directory)) { $something = "$day_num"; $something_good = ".jpg"; $something_real_good = "images/_calendar/July/calendar/" $good_stuff = $something_real_good.$day_num.$something_good; echo '<td width="145px" height="145px" background="<?php $something_real_good; ? >'.$day_num.'</td>'; <--- this is where i need help. $day_num++; $day_count++; } So when the code does the echo i want it to echo out if $day_num is 3... echo '<td width="145px" height="145px" background="images/_calendar/July/calendar/3.jpg">'.$day_num.'</td>'; and when it goes to the HTML it will bring up that picture in that directory as the background.... Thanks for the help, Dauzy Quote Link to comment https://forums.phpfreaks.com/topic/114994-solved-need-help-adding-php-code-in-html-table-tag/ Share on other sites More sharing options...
waynew Posted July 16, 2008 Share Posted July 16, 2008 What's it currently echoing out? Quote Link to comment https://forums.phpfreaks.com/topic/114994-solved-need-help-adding-php-code-in-html-table-tag/#findComment-591370 Share on other sites More sharing options...
dauzy Posted July 16, 2008 Author Share Posted July 16, 2008 it echos out <td width="145px" height="145px" background= "<?php $something_real_good; ? >"3</td> Quote Link to comment https://forums.phpfreaks.com/topic/114994-solved-need-help-adding-php-code-in-html-table-tag/#findComment-591379 Share on other sites More sharing options...
waynew Posted July 16, 2008 Share Posted July 16, 2008 it echos out <td width="145px" height="145px" background= "<?php $something_real_good; ? >"3</td> So it's echoing out the php code aswell? Look at the source after the page loads. Quote Link to comment https://forums.phpfreaks.com/topic/114994-solved-need-help-adding-php-code-in-html-table-tag/#findComment-591385 Share on other sites More sharing options...
DeanWhitehouse Posted July 16, 2008 Share Posted July 16, 2008 echo '<td width="145px" height="145px" background="'.$something_real_good.'"'.$day_num.'</td>'; <--- this is where i need help. it's already in php tags, so this is wrong <?php $something_real_good ?> the above should work Quote Link to comment https://forums.phpfreaks.com/topic/114994-solved-need-help-adding-php-code-in-html-table-tag/#findComment-591386 Share on other sites More sharing options...
dauzy Posted July 16, 2008 Author Share Posted July 16, 2008 Thanks Blade....what you told me worked well thank you very much =)! Quote Link to comment https://forums.phpfreaks.com/topic/114994-solved-need-help-adding-php-code-in-html-table-tag/#findComment-591395 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.