I have a PHP file and want it load in a colorbox modal popup via AJAX but the PHP code inside of the file doesn't get executed (normal HTML tags like divs are visible only if I remove all PHP stuff). I have no idea why this is happening.
I can see e.g. the constants' names (like EP_AVATAR_RESTRICTIONS) but not their content (in this case it's just text).
My colorbox code:
$(".edit_avatar_link").colorbox({
initialWidth:'386',
initialHeight:'528',
innerWidth:'386',
innerHeight:'528',
href: "<?php echo $setting['site_url'];?>/includes/forms/avatar_form2.php",
fixed:true,
scrolling:false,
transition:'none',
onComplete: function(){
$("#cboxLoadedContent").appendTo("#cboxContent");
var title = 'Edit Avatar';
$('#cboxTitle').text(title);
}
});
My PHP-file (avatar_form2.php):
<?php defined( 'AVARCADE_' ) or die( '' ); // Security ?>
<div id="edit_avatar_content">
<div class="edit_profile_header"><?php echo EP_EDIT_AVATAR;?></div>
<div class="edit_avatar_container">
<div class="edit_profile_lable"><img src="<?php echo $user['avatar'];?>" width="75" height="75"></div>
<div class="edit_avatar_element">
<form enctype="multipart/form-data" id="form1" method="post" action="?task=edit_profile&done=avatar">
<input name="new_id" type="hidden" id="new_id" value="<?php echo $new_id;?>" />
<span class="style1"><?php echo EP_AVATAR_UP;?></span>
<input name="img_file" type="file" id="img_file" size="50" /> <input type="Submit" name="Submit" value="<?php echo EP_AVATAR_BUTTON;?>"/>
<?php echo EP_AVATAR_RESTRICTIONS;?>
</form>
</div>
</div>
</div>
It is normal that you don't get anything. Your colorbox calls a programatically protected php file.
This line of code is causing it:
<?php defined( 'AVARCADE_' ) or die( '' ); // Security ?>
This is a direct access protection so that you can not directly access this file. One makes that to only make it includable from other php files that do a DEFINE('AVARCADE_','something');
either remove that line of code or make another php file that defines the AVARCADE_ constant and then include the vatar_form2.php in that file