0

I have this code on my index.php page:

require_once 'includes/settings.php';

require_once 'includes/data_functions.php';

if($_GET["section"] == '1') {
    require_once 'includes/includes.php';

    require_once 'pages/'.$_GET["id"].'.php';
    exit();
}

<!DOCTYPE html>
<html>
<head>

<meta charset="UTF-8">
<title>Integra | <?php echo $PageTitle; ?></title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>

<?php require_once 'includes/includes.php'; ?>

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>

<body class="skin-black-light sidebar-mini sidebar-collapse">

and i use JQuery .load to load pages into a popup div, when loading the page it has the $_GET variable section = 1 so it runs the above code

here is the function that i use to .load pages:

function LoadModal(page, title) {
    title = title || '';

    $( "#modal_page" ).fadeIn("slow");
    $( "#modal_title" ).html(title);

    $("#modal_page_body").html('<h2 align="center">Loading...</h3><p align="center"><i class="fa fa-refresh fa-spin fa-5x"></i></p>'); //$('#LoadingDiv').show();
    $("#modal_page_body").load(page, function(){

    });
    $("html, body").animate({ scrollTop: 0 }, "slow");
}

and then to call this function:

<a href="#" onClick="LoadModal(\'/section/page?seq=add\', \'Add\');" title="Add"><i class="fa fa-plus"></i></a>

so the includes.php file is included in all pages.

this includes some jquery files which have some functions in.

when opening a page in the popup using jquery .load these specific jquery funtcions are not working at all however if i remove the $_GET var (section = 1) to open the page not in the jquery popup (.load) the functions are working fine

what could be causing these to stop working only in the jquery .load

5
  • Could you just post the whole code, or a bit more of it, in context and actually as it's written without saying "and below that, below that" etc. That'll make it easier to help you :). Commented Dec 10, 2015 at 19:29
  • Loading files based on user input is a really really terrible idea. Commented Dec 10, 2015 at 19:31
  • You failed to supply the code which actually calls load, but I'll bet you failed to include the query string there when you passed a URL to it. Commented Dec 10, 2015 at 19:34
  • 1
    Using $_GET, completely unfiltered, to set a file path is a terrible idea. Commented Dec 10, 2015 at 19:34
  • @Quentin sorry - check my update now Commented Dec 10, 2015 at 19:36

1 Answer 1

1

Your URL (/section/page?seq=add) doesn't include section=1 in the query string, so $_GET['section'] is not set.

Sign up to request clarification or add additional context in comments.

1 Comment

sorry - i forgot to mention, my ht access changes /section/ to add section=1 in the query string

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.