Can anyone please help me insert this line of
html and javascript into my
php code?
I have a radio button which when clicked will open deletenews.
php
I want to put that in the
php code so every record will have the radio button next to it so it can be deleted.
- Code: Select all
<input style="border:none;" type="radio" name="loc" onClick="go('index.php?page=deletenews');">
- PHP: Select all
while($code = mysql_fetch_object($q)) {
echo("<h3>".$code->title."</h3><BR>");}
I have escaped the quotes (\") but I am getting an error. It says
Parse error: syntax error, unexpected '>' in ........on line
47
I am sure it's the
$code->title part causing the error and don't know how to get around it
Here is the entire script that works correctly before any changes have been made.
- PHP: Select all
<?
//REMEMBER TO CONNECT TO DATABASE! include_once("../includes/connection.php");
@mysql_connect($host, $user, $password) or die("ERROR--CAN'T CONNECT TO SERVER");
@mysql_select_db($database) or die("ERROR--CAN'T CONNECT TO DB");
//**EDIT TO YOUR TABLE NAME, ECT. $t = mysql_query("SELECT * FROM `news`");
if(!$t) die(mysql_error());
$a = mysql_fetch_object($t);
$total_items = mysql_num_rows($t);
$limit = $_GET['limit'];
$type = $_GET['type'];
$page = $_GET['pagenum']; //set default if: $limit is empty, non numerical, less than 2, greater than 50
if((!$limit) || (is_numeric($limit) == false) || ($limit < 2) || ($limit > 50)) {
$limit = 2; //default
}
//set default if: $page is empty, non numerical, less than zero, greater than total available
if((!$page) || (is_numeric($page) == false) || ($page < 0) || ($page > $total_items)) {
$page = 1; //default
} //calcuate total pages
$total_pages = ceil($total_items / $limit);
$set_limit = $page * $limit - ($limit); //query: **EDIT TO YOUR TABLE NAME, ECT. $q = mysql_query("SELECT * FROM `news` LIMIT $set_limit, $limit");
if(!$q) die(mysql_error());
$err = mysql_num_rows($q);
if($err == 0) die("No matches met your criteria."); //Results per page: **EDIT LINK PATH**
echo("
<a href=?page=delete_news&limit=10&pagenum=1></a>
<a href=?page=delete_news&limit=25&pagenum=1></a>
<a href=?page=delete_news&limit=50&pagenum=1></a>"); //show data matching query:
while($code = mysql_fetch_object($q)) {
echo("<h3>".$code->title."</h3><BR>");
} $id = urlencode($id); //makes browser friendly //prev. page: **EDIT LINK PATH** $prev_page = $page - 1; if($prev_page >= 1) {
echo("<b><<</b> <a href=?page=delete_news&limit=$limit&pagenum=$prev_page><b>Prev.</b></a>");
} //Display middle pages: **EDIT LINK PATH** for($a = 1; $a <= $total_pages; $a++)
{
if($a == $page) {
echo("<b> $a</b> | "); //no link
} else {
echo(" <a href=?page=delete_news&limit=$limit&pagenum=$a> $a </a> | ");
}
} //next page: **EDIT THIS LINK PATH** $next_page = $page + 1;
if($next_page <= $total_pages) {
echo("<a href=?page=delete_news&limit=$limit&pagenum=$next_page><b>Next</b></a> > >");
} //all done
?>