Tem alguma enquete com foto?(resolvido)

Mais
16 anos 2 semanas atrás #17636 por 3r-web
3r-web replied the topic: Re: Tem alguma enquete com foto?
Menú -> Novo -> Wrapper -> coloca o link da página da enquete personalizada...

tenho interesse em enquete com foto, se quizer compartilhar esse sistema... <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Rindo" /><!-- s:lol: -->

[color=#808040:2b9z8ufp]Serviços Online[/color:2b9z8ufp] - [color=#BF8040:2b9z8ufp]Este endereço de email está sendo protegido de spambots. Você precisa do JavaScript ativado para vê-lo.[/color:2b9z8ufp]

Please Entrar ou Registrar to join the conversation.

  • danyx2
  • Avatar de danyx2 Autor do Tópico
  • Offline
  • JCB! Colaborador
  • JCB! Colaborador
Mais
16 anos 2 semanas atrás #17638 por danyx2
danyx2 replied the topic: Re: Tem alguma enquete com foto?
Vou implementar aqui se der certo te passo o script valeu?

Please Entrar ou Registrar to join the conversation.

Mais
16 anos 2 semanas atrás #17692 por tarso
tarso replied the topic: Re: Tem alguma enquete com foto?
acho que fica muito bom uma enquete com fotos, caso encontre deixe a dica ai valeu!!!

Please Entrar ou Registrar to join the conversation.

  • danyx2
  • Avatar de danyx2 Autor do Tópico
  • Offline
  • JCB! Colaborador
  • JCB! Colaborador
Mais
16 anos 1 semana atrás #18106 por danyx2
danyx2 replied the topic: Re: Tem alguma enquete com foto?(resolvido)
Vamos lá tive que adaptar uma enquete com fotos que eu tinha em php:

1 - Criar a tabela no Banco de dados:
--
-- Estrutura da tabela `enquete_musa`
--

CREATE TABLE `enquete_musa` (
`cod` int(11) NOT NULL auto_increment,
`pergunta` varchar(255) NOT NULL,
`opcao` varchar(255) NOT NULL,
`votos` int(11) NOT NULL,
PRIMARY KEY (`cod`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Extraindo dados da tabela `enquete_musa`
--

INSERT INTO `enquete_musa` (`cod`, `pergunta`, `opcao`, `votos`) VALUES
(1, 'Enquete Musa da Balada', 'Layane', 2),
(2, '', 'Nayane', 1),
(3, '', 'Carol', 0),
(4, '', 'Laysla', 0);

2 - Fazer a conexao com o banco:
<?php
$servidor = '';
$usuario = '';
$senha = '';
$banco = '';

$conexao = mysql_connect ($servidor, $usuario, $senha);
mysql_select_db($banco);
?>

3 - O formulário com as respectivas fotos e os scripts em php:
<style type="style.css">
<!--
.style1 {color: #000000}
-->
</style>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style><form name="form1" method="post" action="vt_enquetemusa.php">
<table width="264" height="262" border="0" align="center" bgcolor="#000000">
<tr>
<td><div align="center"><strong><span class="style1">ENQUETE MUSA DA BALADA </span></strong></div></td>
</tr>
<tr>
<td><span class="style1">
<?php
include "conexao.php";
$opcao1 = mysql_query("select * from enquete_musa where cod='1'");

$linha1 = mysql_fetch_object($opcao1);
$opcao2 = mysql_query("select * from enquete_musa where cod='2'");

$linha2 = mysql_fetch_object($opcao2);
$opcao3 = mysql_query("select * from enquete_musa where cod='3'");

$linha3 = mysql_fetch_object($opcao3);
$opcao4 = mysql_query("select * from enquete_musa where cod='4'");

$linha4 = mysql_fetch_object($opcao4);

?>
</span> </td>
</tr>
<tr>
<td width="258"><span class="style1"><?php echo $linha1->pergunta; ?></span></td>
</tr>
<tr>
<td><span class="style1">
<label>
<input type="image" name="imageField2" src="caminho_da_foto" />
<input name="opcao" type="radio" value="1" style="background:#000000">
<?php echo $linha1->opcao; ?><br />
<input type="image" name="imageField" src="caminho_da_foto" />

<input name="opcao" type="radio" value="2" style="background:#000000">
<?php echo $linha2->opcao; ?><br>
<input type="image" name="imageField3" src="caminho_da_foto" />
<input name="opcao" type="radio" value="3" style="background:#000000">
<?php echo $linha3->opcao; ?><br>
<input type="image" name="imageField4" src="caminho_da_foto" />
<input name="opcao" type="radio" value="4" style="background:#000000">
<?php echo $linha4->opcao; ?></label>
</span></td>
</tr>
<tr>
<td><div align="center" class="style1">
<label>
<input type="submit" name="votar" id="votar" value="votar" >
</label>
<br />
<label>

</label>
<br />
</div></td>
</tr>
<tr>
<td colspan="2" align="right" class="style1"><a href="vt_enquetemusa.php"></a></td>
</tr>
</table>>

</form>

4 - Script que vai gerar a votação e mostrar as porcentagens de votos:
<?php
include "conexao.php";
session_start();
if(isset($_SESSION["voto"])) {
?>
<script language="javascript">
alert("Seu espertinho vc ja votou!");
document.location = "enquetemusa.php";
</script>
<?php
exit;
}
if(isset($_POST["opcao"])) {
$opcao = $_POST["opcao"];
}else{
?>
<script language="javascript">
alert("Você deve escolher uma opção");
document.location = "enquetemusa.php";
</script>
<?php
exit;
}
$seleciona = mysql_query("SELECT * FROM enquete_musa WHERE cod='$opcao'");
$objeto = mysql_fetch_object($seleciona);
$add_votos = $objeto->votos;
$add_votos++;
$atualizar = mysql_query("UPDATE enquete_musa SET votos = '$add_votos' WHERE cod='$opcao'");

$sel1 = mysql_query("select * from enquete_musa where cod=1");
$linha1 = mysql_fetch_object($sel1);
$sel2 = mysql_query("select * from enquete_musa where cod=2");
$linha2 = mysql_fetch_object($sel2);
$sel3 = mysql_query("select * from enquete_musa where cod=3");
$linha3 = mysql_fetch_object($sel3);
$sel4 = mysql_query("select * from enquete_musa where cod=4");
$linha4 = mysql_fetch_object($sel4);

$total_votos = $linha1->votos + $linha2->votos + $linha3->votos + $linha4->votos;
?>
<html>
<head>
</head>
<body>
<table width="316" border="0" align="center" bgcolor="#CCCCCC">
<tr>
<td><?php echo $linha1->pergunta; ?></td>
</tr>
<tr>
<td><?php echo $linha1->opcao; ?></td>
</tr>
<tr>
<td><?php echo round($linha1->votos*100/$total_votos); ?>% </td>
</tr>
<tr>
<td><img src="images/musa/musa1.jpg"><img src="images/grafico.jpg" width="<?php echo round($linha1->votos * 100 / $total_votos); ?>" height="10"></td>
</tr>
<tr>
<td><?php echo $linha2->opcao; ?></td>
</tr>
<tr>
<td><?php echo round($linha2->votos * 100 / $total_votos); ?>%</td>
</tr>
<tr>
<br><td><img src="images/musa/musa2.jpg"><img src="images/grafico.jpg" width="<?php echo round($linha2->votos * 100 / $total_votos); ?>" height="10"></td>
</tr>
<tr>
<td><?php echo $linha3->opcao; ?></td>
</tr>
<tr>
<td><?php echo round($linha3->votos * 100 / $total_votos); ?>%</td>
</tr>
<tr>
<td><img src="images/musa/musa3.jpg"><img src="images/grafico.jpg" width="<?php echo round($linha3->votos * 100 / $total_votos); ?>" height="10"></td>
</tr>
<tr>
<td><?php echo $linha4->opcao; ?></td>
</tr>
<tr>
<td><?php echo round($linha4->votos * 100 / $total_votos); ?>%</td>
</tr>
<tr>
<td><img src="images/musa/musa4.jpg"><img src="images/grafico.jpg" width="<?php echo round($linha4->votos * 100 / $total_votos); ?>" height="10"></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>Total de Votos: <?php echo $total_votos; ?></td>
</tr>
<tr>
<td></td>
</tr>
</table>
</body>
</html>
<?php
$voto = 'voto';
$_SESSION = $voto;
?>

é isso ae caso queira ver como ficou <!-- w --> www.cainabalada.com.br <!-- w --> qualquer dúvida é só postar.

Please Entrar ou Registrar to join the conversation.

Mais
16 anos 1 semana atrás #18142 por sniper_rio
sniper_rio replied the topic: Re: Tem alguma enquete com foto?(resolvido)
Meus parabens pela adaptaçao... Mas, como só vi seu topico agora, permita-me que a extensao para joomla PollXt é bastante customizável e faz isto que vc quer sem esquentar "mufa". Depois dá uma checada no meu link abaixo (troopical.com) e vê se é isto...

Abç e desculpe a demora

[color=#0000BF:u0616lek][b:u0616lek]Conheça nossa comunidade 100% brasileira... link abaixo.[/b:u0616lek][/color:u0616lek]
[b:u0616lek][color=#FF0000:u0616lek][url:u0616lek]http://www.troopical.com[/url:u0616lek][/color:u0616lek][/b:u0616lek]
[color=#008000:u0616lek][b:u0616lek]Não respondemos por MP, obrigado![/b:u0616lek][/color:u0616lek]
[b:u0616lek][color=#FF0000:u0616lek]Para organizar o Clube, se seu tópico foi resolvido, coloque [resolvido] no título.[/color:u0616lek][/b:u0616lek]

Please Entrar ou Registrar to join the conversation.