Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/08/2009, 17:29
Serialk89
 
Fecha de Ingreso: agosto-2009
Ubicación: Santiago, Chile
Mensajes: 18
Antigüedad: 14 años, 8 meses
Puntos: 0
Bueno chikos.. es mi primer post aca preguntando, los demas habian sido solamente de informacion ( leer la informacion ) que ademas es muy buena :).

Mi duda es la siguiente, a ver si me pueden ayudar con algo.

Lo que pasa que estoy desarrollando un sistemas de encuestas.. y mi dificultad :S o limite de conocimientos va en que no puedo hacer funcionar la funcion de php. la funcion que tengo tiene que sumar uno al id de la pregunta cada vez que se presione siguiente. pero! no funka y no se porque ¬¬

este es el codigo
Código PHP:
<? 
include("sql.php");
$link conecta_sql();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>

</head>
<body>
<? 

//inicializo pregunta_id para mostrar la primera pregunta de mi BD
$pregunta_id=1;

//El if de si apreta siguiente o no..
if($_POST["btnSiguiente"]){

    
$pregunta_id ++;
    echo 
$pregunta_id;
    
}else{
?>

<form method="post" action="index.php">
<table width="208" border="1">

<? 
$consulta 
"select * from encuesta_pregunta_opciones where op_pre_id=$pregunta_id";
$ejecuta mysql_query($consulta,$link) or die(mysql_error());
$fila mysql_fetch_array($ejecuta);
?>
  <? do{ ?>
  <tr>
    <td width="36"><label>
      <input type="radio" name="radio" id="radio" value="radio" />
    </label></td>
    <td width="124"><? echo $fila['op_des']?></td>
  </tr>
  <? }while( $fila mysql_fetch_array($ejecuta))?>
  <tr>
    <td><label>
      <input type="submit" name="btnAnterior" id="btnAnterior" value="Anterior" />
    </label></td>
    <td>&nbsp;</td>
    <td><input name="btnSiguiente" type="button" value="Siguiente"  /></td>
  </tr>
</table>


</form>
<? ?>
</body>
</html>
el echo $pregunta_id que esta en la funcion es solo para ver si me estaba mostrando algo o funcionando.

Última edición por GatorV; 18/08/2009 a las 19:28