Jump to content

Help writing date onto string in IFRAME


spacepoet

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/265501-help-writing-date-onto-string-in-iframe/
Share on other sites

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";

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.