Jump to content
Fórum Script Brasil
  • 0

Um Sistema De Enquete


Dracom

Question

enquete.html

<title>enquete</title>
<body background="../../../../Documents and Settings/Pedro Paulo/Meus documentos/Minhas imagens/oi.png">
<form name="form1" method="post" action="enquete2.php">
  <p>Nome  
    <input type="text" name="nome">
</p>
  <p>Email
    <input type="text" name="email">
  </p>
  <p> <font color="#FF0000" size="4" face="Times New Roman, Times, serif">O que voce prefere em materia de WebGame?</font></p>
  <p>
    <input name="opcao" type="radio" value="st">
Ttiro </p>
  <p>
    <input name="opcao" type="radio" value="sm">
Magia &amp; Aventura </p>
  <p>
    <input name="opcao" type="radio" value="sc"> 
    Co
    
    rrida &amp; Aventura  </p>
  <p>
    <input name="opcao" type="radio" value="sq">
Querra</p>
  <p>
    <input name="opcao" type="radio" value="sr"> 
  R.P.G  </p>
  </font>
  <p>
    <center>
      <input type="submit" name="Submit" value="Submit"></center>
  </p>
  </body>

  
</form>
apagar.php
<?
$texto=$_POST["delnome"];

if (empty($texto)){
echo ("preencha os campos corretamente");

}else{
$conn = mysql_connect("localhost", "<login>", "<senha>");
$sql = "DELETE FROM aluno WHERE nome = ('$texto')";
mysql_db_query ("aluno",$sql,$conn);
mysql_close($conn);

$conn2 = mysql_connect("localhost", "<login>", "<senha>");
$sql2 ="DELETE FROM nota WHERE nome = ('$texto')";
mysql_db_query ("aluno",$sql2,$conn2);
mysql_close($conn2);
}

?>
<html>
<HEAD>
<TITLE>CONFIRMAÇAO</TITLE>
</HEAD>
<body>
<br> 
<br>
<br>
<br>
<center>
  <p><font color="#FF0000" size="4" face="Times New Roman, Times, serif">Os dados foram deletados corretamente!</font></p>
  <form name="form1" method="post" action="formulario1(sql).html">
    <input type="submit" name="voltar" value="<- voltar">
  </form>
  <p>&nbsp;</p>
</center>
</body>
enquete2.php
<?
$opcao=$_POST["opcao"]; 
$nome=$_POST["nome"];   
$email=$_POST["email"];
$assunto="Comfirmaçao de voto";
$corpo="obrigado por opinar";

$conec=mysql_connect("localhost","<login>","<senha>") or die("Erro na conexão com o banco de dados");
$ltiro="SELECT * FROM votacao WHERE idt = 1";
$query=mysql_db_query ('enquete',$ltiro,$conec) or die ("Erro na execução da instrução MySql");
            
$row=mysql_fetch_row($query);
$campo=$row[0];
$cmagia=$row[1];
$ccorrida=$row[2];
$cquerra=$row[3];
$crpg=$row[4];

$somatiro=$campo + 1;
$smagia=$cmagia + 1;
$scorrida=$ccorrida + 1;
$squerra=$cquerra + 1;
$srpg=$crpg + 1;
mysql_close($conec);





    if($opcao == "st"){
        $conn2 = mysql_connect("localhost", "<login>", "<senha>");
        $sql2 ="UPDATE votacao SET tiro ='$somatiro' where idt=1";
        mysql_db_query ("enquete",$sql2,$conn2);
        mysql_close($conn2);
        header("Location: enquete.htm");
            mail($email,$assunto,$corpo);
                    }
    
    if($opcao == "sm"){
        $conn3 = mysql_connect("localhost", "<login>", "<senha>");
        $sql3 ="UPDATE votacao SET magia ='$smagia' where idt=1";
        mysql_db_query ("enquete",$sql3,$conn3);
        mysql_close($conn3);
        header("Location: enquete.htm");
          
                    }
                    
        if($opcao == "sc"){
        $conn4 = mysql_connect("localhost", "<login>", "<senha>");
        $sql4 ="UPDATE votacao SET corrida ='$scorrida' where idt=1";
        mysql_db_query ("enquete",$sql4,$conn4);
        mysql_close($conn4);
        
header("Location: enquete.htm");
    
                    }
                    
                    
        if($opcao == "sq"){
        $conn5 = mysql_connect("localhost", "<login>", "<senha>");
        $sql5 ="UPDATE votacao SET tiro ='$squerra' where idt=1";
        mysql_db_query ("enquete",$sql5,$conn5);
        mysql_close($conn5);
        
header("Location: enquete.htm");
    
                    }
    
    if($opcao == "sr"){
        $conn6 = mysql_connect("localhost", "<login>", "<senha>");
        $sql6 ="UPDATE votacao SET tiro ='$srpg' where idt=1";
        mysql_db_query ("enquete",$sql6,$conn6);
        mysql_close($conn6);
        header("Location: enquete.htm");

    
                    }    
mail($email,$assunto,$corpo);

?>

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.1k
    • Total Posts
      651.9k
×
×
  • Create New...