spacepoet Posted July 11, 2012 Share Posted July 11, 2012 Hi: I have this code snippet here: echo "<iframe frameborder='0' width='640' height='700' src='calendar.php?month='.date('n').'&year='.date('Y').''></iframe>"; Can't for the life of me figure out how to get it to write the month and the year onto it. The idea is, a user clicks a link on the menu called "Calendar", and he/she is taken to the calendar section (HTML page). There is the text, and then the calendar.php page is pulled into the page via the IFRAME. I just can't seem to get it to write the month and year properly, like this: <iframe frameborder='0' width='640' height='700' src='calendar.php?month=7&year=2012'></iframe> Any ideas? This one is frustrating me .. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/265501-help-writing-date-onto-string-in-iframe/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 11, 2012 Share Posted July 11, 2012 The php string you are echoing starts (and ends) with double-quotes. To close each fragment of that string to concatenate the result of php functions into it, you must use matching double-quotes. echo "a complete string fragment".date('n')."another complete string fragment".date('Y')."another complete string fragment"; Quote Link to comment https://forums.phpfreaks.com/topic/265501-help-writing-date-onto-string-in-iframe/#findComment-1360744 Share on other sites More sharing options...
spacepoet Posted July 11, 2012 Author Share Posted July 11, 2012 Thank you! For the explanation and the code example - everything works fine now! Quote Link to comment https://forums.phpfreaks.com/topic/265501-help-writing-date-onto-string-in-iframe/#findComment-1360948 Share on other sites More sharing options...
GD77 Posted July 12, 2012 Share Posted July 12, 2012 use <object> instead of iframe you wont face errors on validating the page and you don t have to use the scrollbar propertie so you wont get error on Opera when u use css instead to control it Quote Link to comment https://forums.phpfreaks.com/topic/265501-help-writing-date-onto-string-in-iframe/#findComment-1361026 Share on other sites More sharing options...
spacepoet Posted July 13, 2012 Author Share Posted July 13, 2012 Hi there: Thanks for the tip. I must admit I have not heard of this, but certainly willing to try it out and see if it is a better solution. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/265501-help-writing-date-onto-string-in-iframe/#findComment-1361186 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.