BelowisthecodeI'musing.
index.php
<?php
session_start();
if(isset($_SESSION['id'])==0 and isset($_SESSION['nome'])==0){
echo "<script> window.location='login.php'</script>";
}else{
$id=$_SESSION['id'];
$nome=$_SESSION['nome'];
echo "<h3>usuario: $nome <a href='login.php'>sair</a></h3>";
}
?>
<HTML>
<HEAD>
<meta charset="utf-8">
<TITLE>Cadastros</TITLE>
<style>
h1{
color:#8080FF;
background-color:#FF6A6A;
margin-top:-7;
text-shadow:1px 2px 3px #800080;
padding:25px;
font-size:60px;
margin-left:-8;
margin-right:-1;
}
input[type=submit],input[type=text]{
background-color:#FF6A6A ;
border:2px solid #800080;
border-radius:9px;
color:#fff;
}
fieldset{
margin-top:-40;
background-color:#FFFFC0;
margin-left:-8;
margin-right:-1;
}body{
background-color:#8080FF;
}#p1{
color:green;
}#p2{
color:red;
}th{
color:#800080;
}td{
color:#000080;
}#p3{
color:#FF00FF;
}#p4{
color:#800000;
} h3{
font-size:30px;
color:#FFFFFF;
margin-top:90;
}
</style>
</HEAD>
<BODY>
<center>
<h1>Cadastro de Produtos</h1>
<fieldset>
<BR>
<table >
<form action ="evento.php?cadastro=true" method = "post" >
<tr>
<td><label>Produto:</label></td>
<td><input type="text" value='' name='produto' placeholder='Digite o nome do produto' required ></td>
</tr>
<tr>
<td><label>Preço:</label></td>
<td><input type="text" value ='' name='preco' placeholder='Digite o preço do produto' required ></td>
</tr>
</table>
<BR>
<input type="submit" value="cadastrar">
</form>
<BR>
<BR>
<table border="5">
<thead>
<tr>
<th>id</th>
<th>Produto</th>
<th>Preço</th>
<th>Funcionário</th>
<th>Alterar</th>
<th>Excluir</th>
</tr>
</thead>
<center>
<?php
include_once "conexao.php";
$sql = "select * from produto";
$result = mysql_query($sql,$con);
if($result){
while($linha = mysql_fetch_array($result)){
?>
<tbody>
<tr>
<td id='p3'> <?php echo $linha['codigo'];?></td>
<td> <?php echo $linha['nome'];?></td>
<td id='p4'> <?php echo $linha['preco'];?></td>
<td> <?php echo $linha['id_funcionario'];?></td>
<td> <?php echo "<a id='p1' href = editar.php?editar=".$linha['codigo']." >editar </a>";?></td>
<td> <?php echo "<a id='p2' href = evento.php?deletar=".$linha['codigo'].">excluir</a>";?></td>
<tr>
</tbody>
<?php
}//fim do while
}//fim do if
mysql_close($con);
?>
</table>
</fieldset>
<h3 align="center">© Amem!</h3>
<BR>
</BODY>
</HTML>