RobB said:
RobB said:
(e-mail address removed) wrote:
//<![CDATA[
What's that supposed to do?
Thanks,
Liam
//<![CDATA[
Keeps scripts from being parsed in xml. OK, this isn't x(ht)ml, it was
left over from elsewhere. People very picky around here about doctypes,
even in demos.
Yeah, I asked a question in the HTML Authoring newsgroup once and got a
handful of "your page doesn't validate" and only one reply that
actually tried to help with the actual problem.
Although, because of that I have found out that half of what I knew
about HTML has been depricated since 1996 and I'm learning a lot more
about CSS and W3C. =)
The page below is FAR from validating because I'm not finished with it
yet. Hope that doesn't matter....
Post what you've got, I guarantee it's something simple. This ain't
rocket science, bear. :0
OK, here's the entire page. The JS in question is generated in PHP and
echoed in the HTML. It's something I've done a million times and
haven't had problems, so I don't think that's the issue.
Thanks for the help!
PS: I have no idea how Google's going to CR and display this thing, so
just top be careful, here are just the pertinent lines first, then the
whole page.
$js_add = "<script type=\"text/JavaScript\">
//<![CDATA[
function checkdel() {
if (document.getElementById[\"rd_del_yes\"].checked) {
return alert('Are you sure you want to delete this file?');
else return false;
}
}
//]]>
</script>
";
.............
$maindisplay = "<div align=\"left\" class=\"headerLGX\">News Item
Editor</div><p />
<FORM NAME=\"form1\" ID=\"form1\" action=\"index.php?procid=5\"
method=\"POST\" onSubmit=\"return checkdel();\">
<div align=\"left\" class=\"headerLG\">Do you want to delete this
article? <input name=\"rb_del\" id=\"rb_del_no\" type=\"radio\"
value=\"0\" checked>No <input name=\"rb_del\" id=\"rb_del_yes\"
type=\"radio\" value=\"1\"> Yes </div><p />
Now the whole thing in context....
<?php
/*###########################################
## SET UP DATABASE CONNECTION & PROCESS ID
############################################*/
require_once('../connect.php');
$proc = $_GET['procid'];
$js_add = "";
/*###########################################
## GENERATE APPROPRIATE PAGE
############################################*/
if ($proc == "1") {
// SUBMIT THE NEW ITEM TO DB
$newtitle = $_POST['newtitle'];
$newtext = $_POST['newtext'];
$newdate = date("Y-m-d");
$sql_param = "INSERT INTO tbl_news (news_date,news_title,news_text)
VALUES('$newdate','$newtitle','$newtext')";
$result_param = @mysql_query($sql_param, $connection) or $maindisplay
..= "<br />Could not insert info: ".mysql_error();
if (!mysql_error()){
$maindisplay = "<p /><div align=\"center\" class=\"headerLGX\">Your
article was successfully posted to the site!</div>
<p /><div align=\"center\"><a href=\"../news.php\"
class=\"formlink\">Click here to return to the News Page.</a></div>";
}
} elseif ($proc == "2") {
// ENTER A NEW DATE RANGE
$newdaterange = $_POST['dispdays'];
$sql_param = "UPDATE tbl_params SET par_daterange='$newdaterange'";
$result_param = @mysql_query($sql_param, $connection) or $maindisplay
..= "<br />Could not set parameter info: ".mysql_error();
if (!mysql_error()){
Header("Location: index.php?procid=0");
exit;
}
} elseif ($proc == "3") {
// SELECT AN ARTICLE TO EDIT/DELETE
$sql_edit = "SELECT news_id, news_date, news_title FROM tbl_news
WHERE news_active = '1' ORDER BY news_date DESC";
$result_edit = @mysql_query($sql_edit, $connection) or $maindisplay
..= "<br />Could not querey database: ".mysql_error();
while ($row_edit = mysql_fetch_array($result_edit)) {
$n_id = $row_edit[news_id];
$n_date = $row_edit[news_date];
$n_title = $row_edit[news_title];
$menu .= "<option value=\"".$n_id."\">".$n_date." -
".$n_title."</option>";
}
$maindisplay = "<div align=\"left\" class=\"headerLGX\">Select a past
News Item to Edit or Delete:</div><p />
<form action=\"index.php?procid=4\" method=\"post\"
enctype=\"application/x-www-form-urlencoded\" name=\"form1\"
target=\"_self\"><div align=\"center\"><select
name=\"whichitem\"><option value=\"0\" selected>[ select one
]</option>$menu</select><p /><input type=\"submit\" name=\"Submit\"
value=\"Edit This Item\"></div></form><DIV align=\"center\"
class=\"formQ\"><a href=\"index.php?procid=0\" class=\"formlink\">Click
Here to go back to the News Item Creation page.</a></div>";
} elseif ($proc == "4") {
// EDIT/DELETE AN ARTICLE
$item = $_POST['whichitem'];
$sql_edit = "SELECT news_date, news_title, news_text FROM tbl_news
WHERE news_id = '$item'";
$result_edit = @mysql_query($sql_edit, $connection) or $maindisplay
..= "<br />Could not querey database: ".mysql_error();
while ($row_edit = mysql_fetch_array($result_edit)) {
$e_date = $row_edit[news_date];
$e_title = $row_edit[news_title];
$e_text = $row_edit[news_text];
}
$js_add = "<script type=\"text/JavaScript\">
//<![CDATA[
function checkdel() {
if (document.getElementById[\"rd_del_yes\"].checked) {
return alert('Are you sure you want to delete this file?');
}
}
//]]>
</script>
";
$maindisplay = "<div align=\"left\" class=\"headerLGX\">News Item
Editor</div><p />
<FORM NAME=\"form1\" ID=\"form1\" action=\"index.php?procid=5\"
method=\"POST\" onSubmit=\"return checkdel();\">
<div align=\"left\" class=\"headerLG\">Do you want to delete this
article? <input name=\"rb_del\" id=\"rb_del_no\" type=\"radio\"
value=\"0\" checked>No <input name=\"rb_del\" id=\"rb_del_yes\"
type=\"radio\" value=\"1\"> Yes </div><p />
<TABLE align=\"center\" width=\"90%\" border=\"0\"
cellpadding=\"5\" cellspacing=\"5\">
<TR>
<TD align=\"right\" class=\"headerLG\">Title:</TD>
<TD><INPUT type=\"text\" name=\"newtitle\" size=\"40\"
value=\"".$e_title."\"></TD>
</TR>
<TR>
<TD align=\"right\" valign=\"top\" class=\"headerLG\">Text:</TD>
<TD><textarea name=\"newtext\" cols=\"60\" rows=\"20\"
wrap=\"virtual\">".$e_text."</textarea></TD>
</TR>
<TR>
<TD align=\"center\" colspan=\"2\"><INPUT type=\"submit\"
name=\"submitart\" value=\"Submit Changes\"></TD>
</TR>
</TABLE>
</FORM>";
} elseif (($proc == "0") || ($proc == "")) {
// ENTER A NEW ARTICLE FORM
$sql_param = "SELECT * FROM tbl_params";
$result_param = @mysql_query($sql_param, $connection) or $maindisplay
..= "<br />Could not get parameter info: ".mysql_error();
while ($row_p = mysql_fetch_array($result_param)) {
$daterangenum = $row_p[par_daterange];
}
$maindisplay = "<div align=\"left\" class=\"headerLGX\">Submit a New
Item for the News & Events Page</div>
<DIV align=\"center\" class=\"formQ\"><a href=\"index.php?procid=3\"
class=\"formlink\">Click Here if you want to EDIT or DELETE a past News
Item.</a></div><br />
<FORM action=\"index.php?procid=2\" method=\"POST\"
enctype=\"application/x-www-form-urlencoded\" target=\"_self\">
<div align=\"center\" class=\"formQ\"><b>How many days back do you
want visible on the page? (eg: 7 or 30 or 90 or 365...)</b><br />
<INPUT type=\"text\" name=\"dispdays\" size=\"4\"
value=\"".$daterangenum."\"><INPUT type=\"submit\" name=\"submit\"
value=\"Press to Change Date Range\"></div>
</FORM>
<FORM action=\"index.php?procid=1\" method=\"POST\"
enctype=\"application/x-www-form-urlencoded\" target=\"_self\">
<TABLE align=\"center\" width=\"90%\" border=\"0\"
cellpadding=\"5\" cellspacing=\"5\">
<TR>
<TD align=\"right\" class=\"headerLG\">Title:</TD>
<TD><INPUT type=\"text\" name=\"newtitle\" size=\"40\"></TD>
</TR>
<TR>
<TD align=\"right\" valign=\"top\" class=\"headerLG\">Text:</TD>
<TD><textarea name=\"newtext\" cols=\"60\" rows=\"20\"
wrap=\"virtual\"></textarea></TD>
</TR>
<TR>
<TD align=\"center\" colspan=\"2\"><INPUT type=\"submit\"
name=\"submitart\" value=\"Submit New Article\"></TD>
</TR>
</TABLE>
</FORM>
";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>news.jpg</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms
[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
/* Functions that swaps images. */
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array;
for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc)
x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr;
for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
}
/* Functions that handle preload. */
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;
i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image;
d.MM_p[j++].src=a;}}
}
//-->
</script>
<?=$js_add;?>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
..r5_c1 { background-image: url(../images/news_r5_c1.jpg) };
..formQ {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
font-weight: normal;
color: #333333;
}
..formlink {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
font-weight: normal;
}
a.formlink {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
font-weight: normal;
color: #000066;
text-decoration: underline;
}
a.formlink:hover {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
font-weight: normal;
color: #0000FF;
text-decoration: none;
}
..headerLG {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
font-weight: bold;
color: #000000;
}
..headerLGX {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 18px;
font-weight: bold;
color: #000000;
}
-->
</style>
</head>
<body bgcolor="#46311f"
onLoad="MM_preloadImages('../images/news_r2_c2_f2.jpg','../images/news_r2_c4_f2.jpg','../images/news_r2_c7_f2.jpg','../images/news_r2_c10_f2.jpg','../images/news_r7_c5_f2.jpg');">
<table width="770" border="0" align="center" cellpadding="0"
cellspacing="0">
<tr><!-- row 1 -->
<td><img name="news_r1_c1" src="../images/news_r1_c1.jpg"
width="770" height="129" border="0" alt=""></td>
</tr>
<tr><!-- row 2 -->
<td><table align="left" border="0" cellpadding="0" cellspacing="0"
width="770">
<tr><!-- row 1 -->
<td><img name="news_r2_c1" src="../images/news_r2_c1.jpg"
width="105" height="24" border="0" alt=""></td>
<td><a href="../thebook.html" onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('news_r2_c2','','../images/news_r2_c2_f2.jpg',1);"><img
name="news_r2_c2" src="../images/news_r2_c2.jpg" width="127"
height="24" border="0" alt=""></a></td>
<td><img name="news_r2_c3" src="../images/news_r2_c3.jpg"
width="36" height="24" border="0" alt=""></td>
<td><a href="../index.html" onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('news_r2_c4','','../images/news_r2_c4_f2.jpg',1);"><img
name="news_r2_c4" src="../images/news_r2_c4.jpg" width="49" height="24"
border="0" alt=""></a></td>
<td><img name="news_r2_c6" src="../images/news_r2_c6.jpg"
width="41" height="24" border="0" alt=""></td>
<td><a href="../purchase.html" onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('news_r2_c7','','../images/news_r2_c7_f2.jpg',1);"><img
name="news_r2_c7" src="../images/news_r2_c7.jpg" width="116"
height="24" border="0" alt=""></a></td>
<td><img name="news_r2_c8" src="../images/news_r2_c8.jpg"
width="43" height="24" border="0" alt=""></td>
<td><a href="../author.html" onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('news_r2_c10','','../images/news_r2_c10_f2.jpg',1);"><img
name="news_r2_c10" src="../images/news_r2_c10.jpg" width="144"
height="24" border="0" alt=""></a></td>
<td><img name="news_r2_c11" src="../images/news_r2_c11.jpg"
width="109" height="24" border="0" alt=""></td>
</tr>
</table></td>
</tr>
<tr><!-- row 3 -->
<td><img name="news_r3_c1" src="../images/news_r3_c1.jpg"
width="770" height="10" border="0" alt=""></td>
</tr>
<tr><!-- row 4 -->
<td><img name="news_r4_c1" src="../images/news_r4_c1.jpg"
width="770" height="95" border="0" alt=""></td>
</tr>
<tr><!-- row 5 -->
<td class="r5_c1"><table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td width="6%"> </td>
<td width="88%"><?=$maindisplay;?></td>
<td width="6%"> </td>
</tr>
</table></td>
</tr>
<tr><!-- row 6 -->
<td><img name="news_r6_c1" src="../images/news_r6_c1.jpg"
width="770" height="87" border="0" alt=""></td>
</tr>
<tr><!-- row 7 -->
<td><table align="left" border="0" cellpadding="0" cellspacing="0"
width="770">
<tr><!-- row 1 -->
<td><img name="news_r7_c1" src="../images/news_r7_c1.jpg"
width="283" height="22" border="0" alt=""></td>
<td><a href="http://www.ie-studios.net"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('news_r7_c5','','../images/news_r7_c5_f2.jpg',1);"><img
name="news_r7_c5" src="../images/news_r7_c5.jpg" width="206"
height="22" border="0" alt=""></a></td>
<td><img name="news_r7_c9" src="../images/news_r7_c9.jpg"
width="281" height="22" border="0" alt=""></td>
</tr>
</table></td>
</tr>
<tr><!-- row 8 -->
<td><img name="news_r8_c1" src="../images/news_r8_c1.jpg"
width="770" height="11" border="0" alt=""></td>
</tr>
</table>
</body>
</html>