I have 3 files (file1.php, file2.php and file3.php). Their contents are given below. When I load file1.php it shows two times the message of "Hello" in an alert box. But when I include file3.php before or after dialogbox (which is in file2.php) then it shows that message only one times (which is what I want).
Does anybody know where is the problem please?
Thanks.
The content of file1.php
<?php
some operations
require_once("file2.php");
?>
The content of file2.php
<script type="text/javascript">
$(document).ready(function() {
var dialogOpts={
autoOpen: true,
modal: false,
height: "auto",
resizable: false,
closeOnEscape: true,
width: 700,
position: ["center",30]
}
$('#learning_activity_wizard_dialog').dialog(dialogOpts);
});
</script>
<?php
some operations
?>
<div id="learning_activity_wizard_dialog" title="Learning Activity Wizard" class="dialogbox">
some content
<?php require_once("file3.php"); ?>
</div>
The content of file3.php
<script type="text/javascript">
$(function () {
alert('Hello');
});
</script>
sometext
file2.phpyou're missing a closing PHP tag around the include forfile3.php