Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Feb 2013
    Location
    Bangor, Maine
    Posts
    12
    Member #
    35395
    I have a php that generates a date format which corresponds to an external php file. I can display the include statement but I cann't get it to execute. Below is the relevant code:

    formula="include("+y+""+mo+".php);";

    calendarbuild = "<a>"+formula+"</a>";

    document.getElementById('calendar').innerHTML = calendarbuild;

    For Febuary 2013 the formula displays: include(201302.php);
    I need it to execute and not display. Any ideas?

  2.  

  3. #2
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    JavaScript is "client side", meaning it has to load in the users browser memory before it can display.

    PHP is server side, meaning it has to be called and executed on the server before it can generate the output to send to the browser.

    Typically you cannot call call a PHP function from JavaScript because the PHP has to process on the server.

  4. #3
    Junior Member
    Join Date
    Feb 2013
    Location
    Bangor, Maine
    Posts
    12
    Member #
    35395
    I kind of understand what you are saying. Maybe I should explain what it now does and what I am attempting to accomplish. Then maybe someone could help me resolve the issue.

    My current javascript find the current month and year. It then displays it in "February 2013" format. To the left and right are "Prior" and "Next" buttons. Pressing these buttons changes the date to "January 2013" or "March 2013" and so on.

    Below this information I NEED to insert "include(201302.php);" as a function and not a display. The display works and changes appropriately based on the "Prior" and "Next" buttons.

    The whole thing is displayed within a table which is coded in the javascript. Then the script is inserted in a division using:

    <div id="calendar"></div><script type="text/javascript">calendar()</script>

    There is an external file corresponding to each month/year combination. How can I display the appropriate file below the displayed Month/Year displayed date and have the new one display based on the "Prior" and "Next" buttons?

    Thanks

  5. #4
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    Not sure I understand what is in the PHP file that you are calling ???

    Instead of using JavaScript, to write out the stuff ... Create a PHP function ..

    Depending on the page and content... You could use a pagination script to do the next/previous thing.

    Just a thought


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

javascript include statement

Click on a term to search for related topics.
All times are GMT -6. The time now is 06:52 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com