Hi again,
i’m still working on on my project and i encountered another problem. I’m trying to put delete button, but it not works page just refreshs. What i’m doing wrong?
[php]function displayTerms(){
global $database;
$q = "SELECT ID,terminai,reiksme "
.“FROM “.TBL_TERM.” ORDER BY terminai DESC”;
$result = $database->query($q);
/* Error occurred, return given name by default /
$num_rows = mysql_numrows($result);
if(!$result || ($num_rows < 0)){
echo “Error displaying info”;
return;
}
if($num_rows == 0){
echo “Lentelė tuščia.”;
return;
}
/ Display table contents */
echo “<table align=“left” border=“1” cellspacing=“0” cellpadding=“3”>\n”;
echo “
echo “”;
for($i=0; $i<$num_rows; $i++){
$uid = mysql_result($result,$i,“ID”);
$uterm = mysql_result($result,$i,“terminai”);
$ureiksm = mysql_result($result,$i,“reiksme”);
echo "<tr><td>$uterm</td><td>$ureiksm</td><td><input type=hidden name=uid value=$uid><input type=hidden name=subdel value=1><input type=submit value=Ištrinti></td></tr>\n";
}
echo “”;
echo “
\n”;
}
[/php]
[php] function AdminProcess(){
if(isset($_POST[‘subdel’])){
$this->procDeleteTerm2();
}
}
function procDeleteTerm2(){
global $session, $database;
$id=$_GET[‘uid’];
$q = “DELETE FROM”.TBL_TERM.“WHERE ID=’$id’”;
$database->query($q);
header("Location: ".$session->referrer);
}
[/php]