hi,
i have make a login system in which when one logins he will be redirected to the menu page and from there he can ad and remove clubname and playerdetails, when clubname button is pressed add/delete buttons appear on the write side…..the problem is over here after pressing clubname button it gives an error(Parse error: syntax error, unexpected $end)…..please the kindly help me with it….thanks the code is given below….
[code=php]<?php
echo “<h3>$pagetitle</h3>”;
?>
<ul class=”ulnav”>
<li><a href=”index.php?page=category&action=addcategory”>Add New</a></li>
<li><a href=”index.php?page=category&action=editdelete”>Edit/Delete</a></li>
</ul>
<br>
<br>
<?php
if ($_REQUEST[‘page’] == ‘category’ && $_REQUEST[‘action’] == ‘addcategory’) {
if (isset($_REQUEST[‘submit’])) {
$category = $_REQUEST[‘category’];
if ($category != ”){
$chkcat = “select * from category where category=’$category'”;
$chkr = mysql_query($chkcat);
$chknr = mysql_num_rows($chkr);
if ($chknr>0) {
echo “<span class=’message’>Category already exists</span><br><br>”;
} else {
$insert = “insert into category (category) values (‘$category’)”;
mysql_query($insert);
echo “<span class=’message’>Category inserted successfully</span><br><br>”;
}
} else {
echo “<span class=’message’>The Category field must not be empty</span><br><br>”;
}
} else {
?>
<form action=”index.php?page=category&action=addcategory” method=”post” enctype=”multipart/form-data” class=”categoryform” onsubmit=”return validate_registration_form(this)”>
<table>
<tr><td style=”text-align:center;”><p>Please do not include any special characters like <strong>’ ” @ # $ % ^ & * ( ) _ + = -</strong> <br/ > Please use <strong>”and”</strong> instead of <strong>”&”</strong></p></td></tr>
<tr><td style=”text-align:center;”>Category: <input type=”text” name=”category” /></td></tr>
<tr><td style=”text-align:center;”><input type=”submit” name=”submit” value=”Add” style=”color:#000066; text-decoration:none; font-size:100%; padding:5px 10px; margin:0 auto; border:1px solid #00CCFF; background:#DFEBFD;” /> <input type=”reset” name=”reset” value=”Clear form” style=”color:#000066; text-decoration:none; font-size:100%; padding:5px 10px; margin:0 auto; border:1px solid #00CCFF; background:#DFEBFD;” /></td></tr>
</table>
</form>
<?php
} // main form else ends here
} else if ($_REQUEST[‘action’] == ‘editdelete’) {
if (isset($_REQUEST[‘changecategory’]) && $_REQUEST[‘page’] == ‘category’) {
$id = $_REQUEST[‘id’];
$category = $_REQUEST[‘category’];
if ($category != ”)
{
$ucat = “update category set category=’$category’ where id=’$id'”;
mysql_query($ucat);
echo “Updated Successfully<br />”;
}
} else if (isset($_REQUEST[‘deletecategory’]) && $_REQUEST[‘page’] == ‘category’) {
$id = $_REQUEST[‘id’];
// fetch scategory for deleting process
$fscat = “select * from scategory where catid=’$id'”;
$fr = mysql_query($fscat);
$frnr = mysql_num_rows($fr);
if ($frnr > 0) {
for ($f=0; $f<$frnr; $f++)
{
$frw = mysql_fetch_array($fr);
$bdelete = “delete from books where scategory='”.$frw[‘scategory’].”‘”;
mysql_query($bdelete);
}
}
$fres = mysql_query($fscat);
$fresnr = mysql_num_rows($fres);
if ($fresnr > 0) {
$sdelete = “delete from scategory where catid=’$id'”;
mysql_query($sdelete);
}
$delete = “delete from category where id=’$id'”;
mysql_query($delete);
echo “<span class=’message’>Data deleted successfully.</span><br />”;
}
?>
<h4>Select the Category to edit</h4>
<?php
$gcat = “select * from category order by category”;
$gcatr = mysql_query($gcat) or die(“Error: ” . mysql_error());
$gcatnr = mysql_num_rows($gcatr);
if ($gcatnr>0) {
echo “<p>Please do not include any special characters like <strong>’ ” @ # $ % ^ & * ( ) _ + = -</strong> <br/ > Please use <strong>”and”</strong> instead of <strong>”&”</strong></p>”;
for ($g=0; $g<$gcatnr; $g++)
{
$gcatrw = mysql_fetch_array($gcatr);
echo “<form action=’index.php?page=category&action=editdelete’ method=’post’ style=’margin:5px; padding:5px;’>”;
echo “<input type=’hidden’ name=’id’ value='”.$gcatrw[‘id’].”‘ />”;
echo “Category: <input type=’text’ name=’category’ value='”.$gcatrw[‘category’].”‘/>”;
echo “<br/><input type=’submit’ name=’changecategory’ value=’Change’ style=’color:#000066; text-decoration:none; font-size:100%; padding:5px 10px; margin:0 auto; border:1px solid #00CCFF; background:#DFEBFD;’ /> “;
echo “<input type=’submit’ name=’deletecategory’ value=’Delete’ style=’color:#000066; text-decoration:none; font-size:100%; padding:5px 10px; margin:0 auto; border:1px solid #00CCFF; background:#DFEBFD;’ onclick=’javascript: return confirm(“This action will delete all the data related to this category including subcategories and the books listed”);’/>”;
echo “</form><br />”;
}
} else {
echo “No results”;
}
?>
<?php
}
?>