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

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.