Hi,
i'm doing a page where user can register and give up of a course:
<td width="5%">
</td>
<td>
PROGRAMAÇÃO:
<br/>
<?PHP
$cc=$_GET['cod'];
$sql_prog = "SELECT prog_curso FROM cursos WHERE cod_curso=".$cc;
$query_prog = mysql_query($sql_prog, $connect);
while ($row = mysql_fetch_array($query_prog))
{
echo $row['prog_curso'];
}
?>
<br/>
</td>
<?PHP
if(is_logged())
{
?>
<form action="inscreve.php?cod=<?php echo $cc ?>" method="post" class="registration_form">
<input type="submit" name='inscreve' value="Inscrever" />
</form>
<form action="desiste.php?cod=<?php echo $cc ?>" method="post" class="registration_form">
<input type="submit" name='desiste' value="Desistir">
</form>
<?PHP
;}
?>
</tr>
desiste.php:
<?php
include 'topo.php';
include ('db_connect.php');
$cc = $_GET['cod'];
$aluno=$_SESSION['cod_aluno'];
$query_delete_user = "DELETE FROM al_curso WHERE cod_curso=". $cc ." AND cod_aluno=". $aluno;
$result_delete_user = mysql_query($query_delete_user, $connect);
if (!$result_delete_user){
echo '<div class="warning"> Não estava inscrito neste curso. </div>';
}
else
{
header("location: desiste_suc.php?cod=$cc");
}
include 'rodape.php';
?>
desiste_suc.php:
<?PHP
include 'topo.php';
echo '<div class="success"> O aluno desitiu. </div>';
include 'rodape.php';
?>
So, the register part it's working perfectly, but the give up part, i have a student register in Guitar and if i give up it Delets ('til here we're ok) now if i give up again it should say "The student is not register in the course", instead of that it says "Give up successfuly".
Can someone help me?