• Viernes 19 de Abril de 2024, 02:48

Autor Tema:  problemas con php/mysql  (Leído 1426 veces)

eze_ps

  • Nuevo Miembro
  • *
  • Mensajes: 19
    • Ver Perfil
problemas con php/mysql
« en: Martes 31 de Agosto de 2010, 23:28 »
0
quiero que cuando presione en el dibujito de mosificar , aparesca la tabla de modificar
les dejo una imagen para que me ayuden
tambien les dejo mi codigo, si alguien es tan amable de pegarle una pequeña leida en la parte de formularios le agradeceria
<?php include("includes/security.php")?>
<?php include("includes/doctype.php")?>
<head>
<?php include("includes/head.php")?>
<?php include("includes/config.php")?>
<?php include("includes/config.php")?>
<?php


if(isset($_POST['agregar']))
{
   $nuevaencuesta = mysql_query("INSERT INTO  tbl_encuestasp(pregunta,fecha,status ) VALUES('".$_POST[pregunta]."',now(),'".$_POST[status]."')");
   $ultimoid=mysql_insert_id();
   $nuevaopcion=mysql_query("INSERT INTO  tbl_encuestasr(idpregunta,respuesta) VALUES('".$ultimoid."','".$_POST['opcion1']."')");
   $nuevaopcion=mysql_query("INSERT INTO  tbl_encuestasr(idpregunta,respuesta) VALUES('".$ultimoid."','".$_POST['opcion2']."')");
   $nuevaopcion=mysql_query("INSERT INTO  tbl_encuestasr(idpregunta,respuesta) VALUES('".$ultimoid."','".$_POST['opcion3']."')");
   $nuevaopcion=mysql_query("INSERT INTO  tbl_encuestasr(idpregunta,respuesta) VALUES('".$ultimoid."','".$_POST['opcion4']."')");
}







if(isset($_GET['mstatus'])){
   if($_GET['status']==1){
      mysql_query("UPDATE tbl_encuestasp set status=0");
      mysql_query("UPDATE tbl_encuestasp set status=1 where id=".$_GET['mstatus']);
   }else{
      mysql_query("UPDATE tbl_encuestasp set status=0 where id=".$_GET['mstatus']);
   }
}



   
$miencuesta=mysql_query(("SELECT * FROM tbl_encuestasp"));




?>
<?php
//$borrar =mysql_query ("DELETE FROM tbl_encuestasp WHERE pregunta = '' ");
/*if(isset($_POST['Modificar'])){
   mysql_query("UPDATE tbl_encuestap SET pregunta='".$_POST['opcion1']."' pregunta='".$_POST['pregunta']."' WHERE id=".$_POST['id']);   
}*/
?>


<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(']));?></td>
    <td><?php echo($var['fecha']);?></td>
    <td>
   
   
    <?php if($var['status']==0){?>
        <a href="adminencuesta.php?mstatus=<?php echo($var['id'])?>&status=1"><img src="images/cerrar.gif" width="9" height="10" border="0"  /></a>
    <?php }else{ ?>
   
    <a href="adminencuesta.php?mstatus=<?php echo ($var['id'])?>&status=0"> <img src="images/check.gif" width="12" height="14" border="0" />
    <?php } ?>
    </td>
   
   
   
   
   
   
</tr>

<?php } ?>
</table>








<a href="adminencuesta.php?a=1" >Realiza nueva encuesta</a>


<?php if(isset($_GET['a'])){?>

<form  action="adminencuesta.php"method="POST"  >
  <table align="center">
      
        <tr>
      <td>Escribe tu pregunta: <input  name="pregunta" type="text" id="pregunta" size="40"  maxlength="51" align="left" /><br /></td>
       </tr>
       <tr>
       <td>opcion 1: <input name="opcion1" type="text" id="opcion1"size="30"    maxlength="28" /></td>
        </tr>
       <tr>
          <td>opcion 2: <input name="opcion2" type="text" id="opcion2"size="30"  maxlength="28"/></td>
        </tr>
        <tr>
       <td>opcion 3: <input type="text"  name="opcion3"size="30"   maxlength="28"/></td>
        </tr>
         
         <tr>
         <td>opcion 4: <input type="text" name="opcion4" size="30" maxlength="28"/></td>
        </tr>
          </table>
        <input name="agregar" type="submit" onClick="MM_validateForm('pregunta','','R','opcion1','','R','opcion2','','R');return document.MM_returnValue" value="Crear"  />
   
</form>
   
<p>
  <?php }?>
 
 
 
 
 
 
 
</p>
<form id="form2" name="form1" method="post" action="adminencuesta.php">
<table align="center">
  <tr>
    <td>Modifica la pregunta:
      <input  name="modpregunta" type="text" id="modpregunta" onblur="MM_validateForm('modpregunta','','R');return document.MM_returnValue" size="40"  maxlength="51" align="left" />
      <br /></td>
  </tr>
  <tr>
    <td>modifica la opcion 1:
      <input name="modopcion1" type="text" id="modopcion1" onblur="MM_validateForm('modopcion1','','R');return document.MM_returnValue"size="30"    maxlength="28" /></td>
  </tr>
  <tr>
    <td>modifica la opcion 2:
      <input name="modopcion2" type="text" id="modopcion2" onblur="MM_validateForm('modopcion2','','R');return document.MM_returnValue"size="30"  maxlength="28"/></td>
  </tr>
  <tr>
    <td>modifica la opcion 3:
      <input type="text"  name="modopcion3"size="30"   maxlength="28"/></td>
  </tr>
  <tr>
    <td>modifica la opcion 4:
      <input type="text" name="modopcion4" size="30" maxlength="28"/></td>
  </tr>
</table>
<input name="modificar" type="submit" value="modificar"  /></form>
<p>&nbsp;</p>
<?php include("includes/botton.php")?>
</body>
</html>
El mensaje contiene 1 archivo adjunto. Debes ingresar o registrarte para poder verlo y descargarlo.

ibito

  • Miembro HIPER activo
  • ****
  • Mensajes: 549
  • Nacionalidad: mx
  • Se mas de C++ que lo que se de ese CSS
    • Ver Perfil
    • http://www.ibquezada.com
Re: problemas con php/mysql
« Respuesta #1 en: Lunes 13 de Septiembre de 2010, 19:51 »
0
Por favor pon tu código dentro del BBCode"code" porque da pereza leer el código así, y luego en rojo... tendrías mas respuestas si lo tuvieras como te digo.
______________________________________
www.hazjuegos.com Una comunidad dedicada al desarrollo de videojuegos.