Hello,
I am having an issue placing some javascript into a .php header file. I have tried to incorportate it into the scripting, but all I get is php errors.
I want to place a pop-up window script on a log-out link so that members who are leaving the site are asked if thats what they want to do. Here part of the .php header file and then below it, the javascript I need added.
<?php
#
# a_header.php
#
include('php/functions.php');
if (!isset($_SESSION['logged_in'])) $_SESSION['logged_in'] = False;
if ($_SESSION['logged_in']) {
$status = $_SESSION['first_name'].' '.$_SESSION['last_name'].' - Logged In';
} else $status = 'You Are Not Logged In';
$a_space = ' ';
print '<html>';
print '<head>';
print '<title>Are you Ready? - '.$status;
print '</title>';
print '<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">';
print '<LINK href="_style.css" type=text/css rel=stylesheet>';
print '</head>';
print '<body class=bodyclass background="images/header.jpg" leftMargin=0 topMargin=0 MARGINHEIGHT="0" MARGINWIDTH="0">';
print '<table class=header width="800" height="93" border=0 align=center cellPadding=0 cellSpacing=1>';
print '<tr>';
print '<td height="72">';
print '<img src="images/header4.gif" height="72"></td>';
print '</tr>';
#print '<tr><td height="1"><div bgcolor="white"></div></td></tr>';
print '<tr><td height="20">';
print '<table width="800" border="0" cellpadding="1" class=header>';
print ' <tr>';
print ' <td height="20" align="left">'.$status.'</td>';
print ' <td align="right"><div>';
if (isset($_SESSION['admin'])) {
if ($_SESSION['admin']) {
print '<a href="php/admin.php">ADMIN</a>'.$a_space;
}
}
if ($_SESSION['logged_in']) {
print '<a href="index.php">Home</a>'.$a_space;
print '<a href="member.php">Members Area</a>'.$a_space;
print '<a href="contact.php">My Contact Info</a>'.$a_space;
print '<a href="logout.php">Log Off</a>'.$a_space;
}
else {
print '<a href="index.php">Homepage</a>'.$a_space;
print '<a href="signup1.php">Sign-Up</a>'.$a_space;
print '<a href="login.php">Log-In</a>'.$a_space;
print '<a href="support.php">Support</a>'.$a_space;
}
print'</div></td>';
print'</tr>';
print'</table>';
print'</td></tr></table>'.chr(13);
print '<!-- end of header block -->'.chr(13);
Here is the javascript I need to have added to the code above.
<script Language="JavaScript">
<!--
function prelogout() {
window.name="mainwindow";
agree=window.open('prelogout.html','agreement','height=400,width=500,screenX=400,screenY=250,top=250,left=400');
return false;
}
//-->
</script>
onClick='agreement2();return false'"
Any help with this would be appreciated. I have tried adding it but when I do I get php errors.
Thanks
I am having an issue placing some javascript into a .php header file. I have tried to incorportate it into the scripting, but all I get is php errors.
I want to place a pop-up window script on a log-out link so that members who are leaving the site are asked if thats what they want to do. Here part of the .php header file and then below it, the javascript I need added.
<?php
#
# a_header.php
#
include('php/functions.php');
if (!isset($_SESSION['logged_in'])) $_SESSION['logged_in'] = False;
if ($_SESSION['logged_in']) {
$status = $_SESSION['first_name'].' '.$_SESSION['last_name'].' - Logged In';
} else $status = 'You Are Not Logged In';
$a_space = ' ';
print '<html>';
print '<head>';
print '<title>Are you Ready? - '.$status;
print '</title>';
print '<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">';
print '<LINK href="_style.css" type=text/css rel=stylesheet>';
print '</head>';
print '<body class=bodyclass background="images/header.jpg" leftMargin=0 topMargin=0 MARGINHEIGHT="0" MARGINWIDTH="0">';
print '<table class=header width="800" height="93" border=0 align=center cellPadding=0 cellSpacing=1>';
print '<tr>';
print '<td height="72">';
print '<img src="images/header4.gif" height="72"></td>';
print '</tr>';
#print '<tr><td height="1"><div bgcolor="white"></div></td></tr>';
print '<tr><td height="20">';
print '<table width="800" border="0" cellpadding="1" class=header>';
print ' <tr>';
print ' <td height="20" align="left">'.$status.'</td>';
print ' <td align="right"><div>';
if (isset($_SESSION['admin'])) {
if ($_SESSION['admin']) {
print '<a href="php/admin.php">ADMIN</a>'.$a_space;
}
}
if ($_SESSION['logged_in']) {
print '<a href="index.php">Home</a>'.$a_space;
print '<a href="member.php">Members Area</a>'.$a_space;
print '<a href="contact.php">My Contact Info</a>'.$a_space;
print '<a href="logout.php">Log Off</a>'.$a_space;
}
else {
print '<a href="index.php">Homepage</a>'.$a_space;
print '<a href="signup1.php">Sign-Up</a>'.$a_space;
print '<a href="login.php">Log-In</a>'.$a_space;
print '<a href="support.php">Support</a>'.$a_space;
}
print'</div></td>';
print'</tr>';
print'</table>';
print'</td></tr></table>'.chr(13);
print '<!-- end of header block -->'.chr(13);
Here is the javascript I need to have added to the code above.
<script Language="JavaScript">
<!--
function prelogout() {
window.name="mainwindow";
agree=window.open('prelogout.html','agreement','height=400,width=500,screenX=400,screenY=250,top=250,left=400');
return false;
}
//-->
</script>
onClick='agreement2();return false'"
Any help with this would be appreciated. I have tried adding it but when I do I get php errors.
Thanks