Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/06/2012, 08:48
Avatar de maii86
maii86
 
Fecha de Ingreso: mayo-2012
Ubicación: Leon
Mensajes: 7
Antigüedad: 12 años
Puntos: 0
js dentro de condicional php?

Hola! estoy intentando que un formulario se muestre segun un condicional de php.
Lo que me gustaria es que al dar a editar se cambie un formulario por otro... lo que no se si esto es posible... ya que innerHTML tampoco me funcionaba.
bueno lo muestro mejora ver si me podeis decir si se puede hacer esto o si hay alguna forma mejor!
1000 grasias!!!


<?php

$var1=($_GET['pagina']);
$var2=($_GET['cliente']);
if(($var1)&($var2)){ //hasta aqui entra pero al hacer click en la imagen hace un hidden momentaneo y vuelve al formulario inicial

?>
<script>
document.getElementById("formulario").style.visibi lity='hidden';
document.getElementById("formulario2").style.visib ility='visible';
</script>
<?
}

$resultado = mysql_query("SELECT id,nombre FROM clientes);
?>
<table>
<tr>
<th>Id</th>
<th>Nombre</th>
</tr>
<?php
while ($fila = mysql_fetch_array($resultado, MYSQL_ASSOC)){
$nfila= $fila['id'];
echo "<tr>";
echo "<td> ".$fila['id']." </td>";
echo "<td> ".$fila['nombre']." </td>";
echo '<td><a href="intranet.php?pagina=boton1&cliente='.$nfila. '"><img src='editar.gif'/></a></td>'; //al hacer click en la imagen refresca la pantalla
echo "</tr>";
}
?>
</table>


<div id="formulario">
<form action="" method="post" >
<label for="nombre">Nombre:</label>
<input type="text" name="nombre" id="textfield" />
</form>
</div>



<div id="formulario2" style="visibility:hidden">
<form action="" method="post">
<label for="nombre">Nombre:</label>
<input type="text" name="nombre" id="textfield" />
<label for="id"></label>
<input type="hidden" name="id" value="aqui php" />
</form>
</div>


Bueno espero que me puedan ayudar!si no he sido muy clara decirmelo que especifico mas.