Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/08/2009, 17:44
Avatar de urgido
urgido
 
Fecha de Ingreso: febrero-2005
Mensajes: 2.351
Antigüedad: 19 años, 2 meses
Puntos: 25
Respuesta: Ayuda con funcion de php.

no comprendo mucho que deseas hacer pero le modifique algunas cositas espero y sea lo que buscas de lo contrario postea aqui ;)
Código PHP:
Ver original
  1. <?
  2. include("sql.php");
  3. $link = conecta_sql();
  4. ?>
  5.  
  6. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  7. <html xmlns="http://www.w3.org/1999/xhtml">
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  10. <title>Documento sin título</title>
  11.  
  12. </head>
  13. <body>
  14. <?
  15.  
  16. //inicializo pregunta_id para mostrar la primera pregunta de mi BD
  17. $pregunta_id=1;
  18.  
  19. //El if de si apreta siguiente o no..
  20. if(isset($_POST["btnSiguiente"])){
  21.  
  22.     $pregunta_id++;
  23.     echo $pregunta_id;
  24.    
  25. }else{
  26. ?>
  27.  
  28. <form method="post" action="index.php">
  29. <table width="208" border="1">
  30.  
  31. <?
  32. $consulta = "select * from encuesta_pregunta_opciones where op_pre_id=$pregunta_id";
  33. $ejecuta = mysql_query($consulta,$link) or die(mysql_error());
  34. $fila = mysql_fetch_array($ejecuta);
  35. ?>
  36.   <? do{ ?>
  37.   <tr>
  38.     <td width="36"><label>
  39.       <input type="radio" name="radio" id="radio" value="radio" />
  40.     </label></td>
  41.     <td width="124"><? echo $fila['op_des']?></td>
  42.   </tr>
  43.   <? }while( $fila = mysql_fetch_array($ejecuta))?>
  44.   <tr>
  45.     <td><label>
  46.       <input type="submit" name="btnAnterior" id="btnAnterior" value="Anterior" />
  47.     </label></td>
  48.     <td>&nbsp;</td>
  49.     <td><input name="btnSiguiente" type="button" value="Siguiente"  /></td>
  50.   </tr>
  51. </table>
  52.  
  53.  
  54. </form>
  55. <? } ?>
  56. </body>
  57. </html>
__________________
Hospedaje Web al mejor costo!