Ver Mensaje Individual
  #4 (permalink)  
Antiguo 22/10/2013, 07:21
jegggf
 
Fecha de Ingreso: septiembre-2012
Ubicación: montevideo
Mensajes: 131
Antigüedad: 11 años, 7 meses
Puntos: 0
Respuesta: inconveniente con formulario php mysql

gracias, es posible que este quedan do ciego, al los select no les puedo poner unname porque estan en un while, no se si sera eso y que solucion pudo implementar.
















Código PHP:
Ver original
  1. include ("conecta.php");
  2.  
  3. function adjudicar($objetos,$lugares)
  4. {
  5.  
  6. global $db_selected;
  7. global $db;
  8.  
  9. $usertable1 = "prueba3";
  10.  
  11.  
  12. $objetos = mysql_real_escape_string($objetos,$db);
  13. $lugares = mysql_real_escape_string($lugares,$db);
  14.  
  15.  
  16. if ($objetos != "" && $lugares != "")
  17. {
  18. $objetos = $_POST['objetos'];
  19. $lugares = $_POST['lugares'];
  20.  
  21.  
  22. $query = "INSERT INTO prueba3 (objetos,lugares) " . "VALUES ('$objetos,$lugares')";
  23.  
  24. $result = mysql_query($query,$db);
  25.  
  26. //echo "$query";
  27. echo "lugar adjudicado<br><br>";
  28. echo "<a href = 'http://www.fxb4.com/juanmegasoft/0pf/formulario.php''> Volver al menu </a>";
  29.  
  30. }
  31. else
  32. {
  33. echo "rellena los dos campos<br><br>";
  34. echo "<a href = 'http://www.fxb4.com/juanmegasoft/0pf/formulario.php'> Volver al menu </a>";
  35. }
  36.  
  37.  
  38. }
  39. adjudicar($objetos,$lugares);
  40. ?>
  41.  
  42.  
  43. el formulario base es:
  44.  
  45.  
  46.  
  47.  
  48. <form method="post" action="ingreso.php" name= "formulario" >
  49.  
  50. Objeto:<input type="text" name="objetos"> <br><br>
  51. Valor:<input type="text" name="valor"> <br><br>
  52. Peso:<input type="text" name="peso"> <br><br>
  53.  
  54. <input type="submit" value="insertar"> <br><br>
  55.  
  56. </form>
  57.  
  58. <a href = "elimina.php">Borrar<a/> <br>
  59. <a href = "editar.php">Editar<a/> <br><br>
  60.  
  61. <form method="post" action="buscar.php" name= "formulariobuscar" >
  62.  
  63. Buscar:<input type="text" name="busca"> <br><br>
  64.  
  65. <input type="submit" value="buscar"> <br><br>
  66.  
  67. </form>
  68.  
  69. <br>
  70. <a href = "http://www.fxb4.com/juanmegasoft/0pf/asignacion/formularioasignacion.php">asignar lugares</a>
  71. <br>
  72. <a href = "http://www.fxb4.com/juanmegasoft/0pf/lugares/formulariolugares.php">modificar lugares y capacidad</a>
  73. <br><br>
  74.  
  75.  
  76. <?php
  77.  
  78. include("conecta.php");
  79.  
  80. global $db_selected;
  81. global $db;
  82. $usertable = 'prueba3';
  83.  
  84. $result = mysql_query("SELECT * FROM prueba3", $db);
  85.  
  86. echo "<table border = '0'> \n";
  87. echo "<tr><td>objeto</td><td>lugar</td></tr> \n";
  88. while ($row = mysql_fetch_row($result)){
  89. echo "<tr><td>$row[0]</td><td>$row[1]</td></tr> \n";
  90. }
  91. echo "</table> \n";
  92.  
  93. ?>