/* Compile News List */
$result = mysql_query("SELECT * FROM cms_news ORDER BY news_postdate DESC");
if((mysql_num_rows($result))== '0'){
echo 'There are currently no news articles available<br /><br />';
}
echo'
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td bgcolor="#999999">Edit News</td>
</tr>
</table>
<table width="100%" cellpadding="3" cellspacing="1" style="margin-top: 0px;">
<tr>
<td align="center" width="70" bgcolor="#CCCCCC"><a href="">ID</a></td>
<td align="center" width="622" bgcolor="#CCCCCC"><a href="">Title</a></td>
<td align="center" width="177" bgcolor="#CCCCCC"><a href="">Date
Created</a></td>
<td width="95" colspan="2" align="center" bgcolor="#CCCCCC" nowrap>Actions</td>
</tr>
</table>
'; while ($row = mysql_fetch_assoc($result)) { echo'
<table width="100%" cellpadding="3" cellspacing="1" style="margin-top: 0px;">
<tr>
<td align="center" width="70" bgcolor="#CCCCCC">' . $row['news_id'] . '</td>
<td align="center" width="622" bgcolor="#CCCCCC">
<div align="left">' . $row['news_title'] . '</div>
</td>
<td align="center" width="177" bgcolor="#CCCCCC">
<div align="left">' . $row['news_postdate'] . '</div>
</td>
<td width="95" align="center" bgcolor="#999999"><a href="editnews.php?mode=edit&news_id=' . $row['news_id'] . '"><img src="/images/edit_icon.gif" width="16px" height="16px" alt="Edit article" title="Edit article" border="0px" /></a>
<a onClick="if(confirmSubmit('Are you sure you want to delete this article?')) location.href='editnews.php?mode=edit&news_id=' . $row['news_id'] . ''; return false;" href="#"><img src="/images/delete_icon.gif" width="16px" height="16px" alt="Delete article" title="Delete article" border="0px" /></a>
</a></td>
</tr>
</table>
';
}
/* END Compile News List */
I'm unsure on how to include the Javascript code into this PHP echo code.
The Javascript code confirms deletion of an article. I have included this function from another file called script_functions.js
Here is the javascript code
function confirmSubmit(string,url)
{
var agree=confirm(string);
if (agree)
return true ;
else
return false ;
}
If someone can sort this code out for me that would be great.
Thanks!