www.webdeveloper.com
Results 1 to 2 of 2

Thread: Including php file instead of load()

  1. #1
    Join Date
    Oct 2011
    Posts
    54

    Including php file instead of load()

    Hello,
    I'm using this script right now:
    mainpage.php
    HTML Code:
    <?php
    $mainpage = 'secret';
    ?>
    <a href="#" id="renamegroups">Rename groups</a>
    <div id='renamegroupsl'>
    </div>
    
    
    <script type="text/javascript">
    $('#renamegroups').click(function(){
       $("#renamegroupsl").load("../information/renamegroups.php");
       return false;
    });
    </script>
    renamegroups.php
    PHP Code:
    <?php
    echo $mainpage;
    ?>
    The problem is that I get this error:
    Notice: Undefined variable: mainpage in (...)
    So how could I include a file with ajax / jquery (because if I include the file this will work and the error won't show up)

    Thanks!

  2. #2
    Join Date
    Feb 2011
    Posts
    231
    Hy,
    In php you can use $_SESSION to keep and get the value of a variable from one page to another.
    Or, use ajax(), and pass the value of that variable via POST, than, in the php file you get the value using: $variable = $_POST['name'];

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles