A questão é que não sei mais o que fazer estou começando a programar,por isso sei o basico,mas esta acontecendo o seguinte,não consigo passar as variaveis do php pro html,por exempo se utilizo elas com o echo ou print beleza vai normal,só que tipo preciso repassar elas pra um select e não pega,e não é só no select pois qualquer parte do html tipo assim <?=$registro["nome"]?> não pega =/,não sei oque acontece pois já instalei php,apache,mysql por parte,já instalei o xampp tb nada e agora to utilizando o wamp tb nada...
<? include ("conexao.php");?>
<html>
<head>
<title> TEste </title>
</head>
<body>
<form name="alterar" method = "post" action ="index.php?link=3">
selecione um nome:
<select name = "selecao" size "1" id="selecao" >
<?php
$sql= "SELECT nome FROM cliente order by nome";
$resultado = mysql_query($sql) or die ("não foi possível realizar a consulta, verifique a conexão");
While($registro=mysql_fetch_array($resultado))
{
?>
<option >
<?=$registro["nome"]?>
</option>
<?php
}
mysql_free_result($resultado);
?>
</select>
<input name="ok" type = "submit" value = "OK">
</form>
</body>
</html>
O resto do programa ta beleza...só não consigo fazer pegar variavel nenhuma no html
Pergunta
Dimitrov
A questão é que não sei mais o que fazer estou começando a programar,por isso sei o basico,mas esta acontecendo o seguinte,não consigo passar as variaveis do php pro html,por exempo se utilizo elas com o echo ou print beleza vai normal,só que tipo preciso repassar elas pra um select e não pega,e não é só no select pois qualquer parte do html tipo assim <?=$registro["nome"]?> não pega =/,não sei oque acontece pois já instalei php,apache,mysql por parte,já instalei o xampp tb nada e agora to utilizando o wamp tb nada...
se alguém puder me de uma luz ai...
valeu
index.php
<html> <head> <title> PHP </title> </head> <body> <table width = "100%" border = "1" cellspacing = "0" cellpadding = "0"> <tr> <td> <table width = "100%" border = "1" cellspacing = "0" cellpadding = "0"> <tr> <td colspan="2">Cabeçalho</td> </tr> <tr> <td width ="20%"> <table width = "100%" border = "1" cellspacing = "0" cellpadding = "0"> <tr> <td>Menu de opçoes </td></tr> <tr> <td><a href="index.php?link=1">Home </a></td></tr> <tr> <td><a href="index.php?link=2">Inserir</a> </td></tr> <tr> <td><a href="index.php?link=3">Alterar</a> </td></tr> <tr> <td>Excluir </td></tr> <tr> <td>Consultar </td></tr> </table> </td> <td> <table width = "100%" border = "1" cellspacing = "0" cellpadding = "0"> <tr><td> <?php $link=$_GET["link"]; $pag[1]="home.php"; $pag[2]="formcliente.php"; $pag[3]="selecionaalterar.php"; if (!empty ($link)) { if (file_exists($pag[$link])) { include $pag[$link]; } } else { print "a pagina não foi encontrada"; } ?> </td></td> </table> </td> </tr> </table> </td> </tr> </table> </body> </html>selecionaalterar.php<? include ("conexao.php");?> <html> <head> <title> TEste </title> </head> <body> <form name="alterar" method = "post" action ="index.php?link=3"> selecione um nome: <select name = "selecao" size "1" id="selecao" > <?php $sql= "SELECT nome FROM cliente order by nome"; $resultado = mysql_query($sql) or die ("não foi possível realizar a consulta, verifique a conexão"); While($registro=mysql_fetch_array($resultado)) { ?> <option > <?=$registro["nome"]?> </option> <?php } mysql_free_result($resultado); ?> </select> <input name="ok" type = "submit" value = "OK"> </form> </body> </html>O resto do programa ta beleza...só não consigo fazer pegar variavel nenhuma no html
Link para o comentário
Compartilhar em outros sites
5 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.