...

View Full Version : Not opening Javascript Script



CoolAsCarlito
03-18-2010, 12:46 AM
I don't know why but under case 1 it won't open the javascript date picker when you click the link and not sure why.



<?php
$e = <<<here
<script type="text/javascript" src="http://www.kansasoutlawwrestling.com/backstage/jscripts/ajax.js"></script>
<script type=text/javascript src=http://www.kansasoutlawwrestling.com/backstage/jscripts/ts_picker.js></script>
here;
switch ($_REQUEST['option']) {
case 0:
echo $e;
$query = "SELECT *
FROM `efed_content_news`
WHERE category_id = '{$id}'";
?>
<h1 class=backstage>News Management</h1><br />
<h2 class=backstage>News Articles :: <a href="#" onclick="ajaxpage('backstage_libs/news.php?option=1', 'content'); return false;">Add New</a></h2><br />
<?php
$query = "SELECT * FROM efed_content_news AS news, efed_list_newscategory AS newscat WHERE newscat.id = news.category_id";
$result = mysql_query ( $query );
$rows = mysql_num_rows($result);
if ($rows > 0) {
print'<table width="100%" class="table1">
<tr class="rowheading">
<td>&nbsp;</td>
<td width=100 align=center>Category ID</td>
<td>Title</td>
</tr>';
$i = 0;
while ( $row = mysql_fetch_array ( $result, MYSQL_ASSOC ) ) {
$sClass = 'row2';
if ($i++ % 2) $sClass = 'row1';
printf ( "<tr class=\"%s\">", $sClass );
print "<td valign=\"top\" align=center width=35><a href=\"#\" onclick=\"ajaxpage('backstage_libs/news.php?option=2&id=$row[id].', 'content'); return false;\">Edit</a></td>";
printf ( "<td align=\"center\" valign=\"top\">%s</td>", $row ['categoryname'] );
printf ( "<td valign=\"top\">%s</td>", $row ['title'] );
echo '</tr>';
}
echo '</table><br><br />';
} else {
echo '<span>There are no news postings.</span><br /><br />';
}
returnmain();
break;
case 1:
echo $e;
require_once('../backstageconfig.php');
require_once('../backstagefunctions.php');
?>
<h1 class="backstage">News Management</h1><br />
<h2 class="backstage">Add News Posting</h2><br />
<form name="characters" method="post">
<input type="hidden" name="action" value="news" />
<table width="100%" class="table2">
<tr>
<td class=rowheading>Category:</td><td class="row3">
<select name="category" class="selection">
<option value="0">- Select -</option>
<?php
$query = 'SELECT categoryname,id FROM efed_list_newscategory';
$result = mysql_query ( $query );
while ( $row = mysql_fetch_assoc ( $result ) )
{
print "<option value=\"".$row['id']."\">".$row['categoryname']."</option>\r";
}
?>
</select></td>
</tr>
<tr>
<td class="rowheading">Posting Date:</td><td class="row3"><input type="text" name="postingdate" class="fieldtext80" value=""><a href="javascript:show_calendar(document.eventbooker.postingdate, document.eventbooker.postingdate.value);"><img src="http://www.kansasoutlawwrestling.com/backstage/images/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick the date"></a></td>
</tr>
<tr>
<td width="120" class="rowheading">Title:</td><td class="row3"><input type="text" name="title" class="fieldtext490"></td>
</tr>
<tr>
<td width="120" class="rowheading">Teaser:</td><td class="row3"><input type="text" name="teaser" class="fieldtext490" value=""></td>
</tr>
<tr>
<td width="120" class="rowheading" valign="top">Content:</td><td class="row3"><textarea name="content" class="textarea490x100"></textarea></td>
</tr>
</table><br />
<input type="hidden" name="newadded" value="true">
<input type="submit" value="Save News" class="button"></form><br />
<form method="post"><input type="button" value="Return to News Posting List" class="button200" name="return">
</form><br />
<?php
returnmain();
break;
case 2:
echo $e;
require_once('../backstageconfig.php');
require_once('../backstagefunctions.php');
$id = $_GET['id'];
$query = mysql_query("SELECT * FROM `efed_bio` WHERE `id` = '" . $id . "'");
$row = mysql_fetch_array($query);
?>
<h1 class="backstage">News Management</h1><br />
<h2 class="backstage">Add News Posting</h2><br />
<form name="characters" method="post">
<input type="hidden" name="action" value="news" />
<table width="100%" class="table2">
<tr>
<td class=rowheading>Category:</td><td class="row3">
<select name="category" class="selection">
<option value="0">- Select -</option>
<?php
$query = 'SELECT categoryname,id FROM efed_list_newscategory';
$result = mysql_query ( $query );
while ( $row = mysql_fetch_assoc ( $result ) )
{
print "<option value=\"".$row['id']."\">".$row['categoryname']."</option>\r";
}
?>
</select></td>
</tr>
<tr>
<td class="rowheading">Posting Date:</td><td class="row3"><input type="text" name="postingdate" class="fieldtext490" value=""></td>
</tr>
<tr>
<td width="120" class="rowheading">Title:</td><td class="row3"><input type="text" name="title" class="fieldtext490"></td>
</tr>
<tr>
<td width="120" class="rowheading">Teaser:</td><td class="row3"><input type="text" name="teaser" class="fieldtext490" value=""></td>
</tr>
<tr>
<td width="120" class="rowheading" valign="top">Content:</td><td class="row3"><textarea name="content" class="textarea490x100"></textarea></td>
</tr>
</table><br />
<input type="hidden" name="newadded" value="true">
<input type="submit" value="Save News" class="button"></form><br />
<form method="post"><input type="button" value="Return to News Posting List" class="button200" name="return">
</form><br />
<?php
returnmain();
break;
}

function news() {
if ((!empty($_POST['newadded']))) {
$category = mysql_real_escape_string($_POST['category']);
$postdate = mysql_real_escape_string($_POST['postdate']);
$title = mysql_real_escape_string($_POST['title']);
$teaser = mysql_real_escape_string($_POST['teaser']);
$content = mysql_real_escape_string($_POST['content']);
$query = "INSERT INTO `efed_content_news` (category_id,postdate,title,teaser,content) VALUES ('".$category."', '".$postdate."', '".$title."', '".$teaser."', '".$content."')";
mysql_query($query);
echo $query;
}
}
?>

mlseim
03-18-2010, 02:22 AM
Make your page so that it is rendering case 1, copy the HTML as it's rendered,
and show us that HTML. I think it might be more apparent when we see how
the HTML was rendered for case 1.

CoolAsCarlito
03-18-2010, 06:34 AM
I'm lost.

mlseim
03-18-2010, 12:26 PM
Give us the link to the page that has the pop-up calendar on it.

CoolAsCarlito
03-18-2010, 05:17 PM
I'll send it to you in PM.

Fou-Lu
03-18-2010, 05:28 PM
Post back when determined; I'm assuming that the 'not open' is referring to a JS issue, not a PHP one. I'll move it to the JS forum if thats the case.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum