Quantcast
Channel: Últimos conteúdos
Viewing all articles
Browse latest Browse all 14190

Options do menu não aparece

$
0
0

Estou tentando incluir php dentro de uma tabela oculta para formulario dinamico, mas não aparece nada nos options.

O que está errado????

 

Código da página

<script type="text/javascript">//<![CDATA[
$(window).load(function(){
var input = document.querySelectorAll('input[type="radio"]');
var tabelaextra = document.querySelectorAll('table.tabelaextra');

function mostrar(el) {
    for (var i = 0; i < tabelaextra.length; i++) {
        tabelaextra[i].classList.add('escondida');
    }
   document.getElementById('t' + el.id).classList.remove('escondida');
}
for (var i = 0; i < input.length; i++) {
    console.log(i, input.length, input[i]);
    input[i].addEventListener('click', function () {
        mostrar(this);
    });
}

});//]]> 

</script>

</head>
<body>
  <table>
    <tbody><tr>
        <td>
            <input required="required" value="Evento" name="tipo" id="evento" type="radio">
            <label for="tipo">Evento.</label>
            <input required="required" value="Viagem" name="tipo" id="viagem" type="radio">
            <label for="tipo">Viagem</label>
        </td>
    </tr>
</tbody></table>
<table id="tevento" class="tabelaextra escondida"><tbody><tr><td>
<select name="eventos">
<?php
$sql = "select * from eventos";
$resultado = mysql_query($sql,$db) or die(mysql_error()); 
while($dados = mysql_fetch_array($resultado)){
$viagens= $dados['evento'];
echo "<option value='$evento'>$evento</option>";
}
?>
</td></tr></tbody></table>
<table id="tviagem" class="tabelaextra escondida"><tbody><tr><td>Menu de Viagens</td></tr></tbody></table>
  

Código da página de conexao:  db.php

<?php

error_reporting (E_ALL & ~ E_NOTICE & ~ E_DEPRECATED);

# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_db = "localhost";
$database_db = "lazer";
$username_db = "root";
$password_db = "";
$db = mysql_pconnect($hostname_db, $username_db, $password_db) or trigger_error(mysql_error(),E_USER_ERROR); 
?>

Viewing all articles
Browse latest Browse all 14190

Trending Articles