Guest User

Untitled

a guest
Aug 11th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. php code:
  2. $editFormAction = $_SERVER['PHP_SELF'];
  3. if (isset($_SERVER['QUERY_STRING'])) {
  4. $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  5. }
  6. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  7. $insertSQL = sprintf("INSERT INTO reservations_clients (user, number_person, table, date) VALUES (%s, %s, %s, %s)",
  8. GetSQLValueString($_POST['user'], "text"),
  9. GetSQLValueString($_POST['number_person'], "int"),
  10. GetSQLValueString($_POST['table'], "int"),
  11. GetSQLValueString($_POST['date'], "text"),
  12.  
  13. mysql_select_db($database_conexionbdd, $conexionbdd);
  14. $Result1 = mysql_query($insertSQL, $conexionbdd) or die(mysql_error());
  15.  
  16. mysql_select_db($database_conexionbdd, $conexionbdd);
  17. $query_table = "SELECT * FROM tables";
  18. $table = mysql_query($query_table, $conexionbdd) or die(mysql_error());
  19. $row_table = mysql_fetch_assoc($table);
  20. $totalRows_tables = mysql_num_rows($table);
  21.  
  22.  
  23.  
  24.  
  25.  
  26. the form:
  27.  
  28. <form method="post" name="form1" action="<?php echo $editFormAction; ?>">
  29. <table align="center">
  30. <tr valign="baseline">
  31. <td nowrap align="right">Number_person:</td>
  32. <td><input type="text" name="Number of persons" value="" size="32"></td>
  33. </tr>
  34. <tr valign="baseline">
  35. <td nowrap align="right">table:</td>
  36. <td><select name="numero_mesa">
  37. <?php
  38. do {
  39. ?>
  40. <option value="<?php echo $row_table['idtable']?>" <?php if (!(strcmp($row_tables['idtable'], $row_table['idtable']))) {echo "SELECTED";} ?>><?php echo $row_table['name_table']?></option>
  41. <?php
  42. } while ($row_table = mysql_fetch_assoc($table));
  43. ?>
  44. </select></td>
  45. <tr>
  46. <tr valign="baseline">
  47. <td nowrap align="right">date:</td>
  48. <td><input type="text" name="fecha" size="32" id="datepicker" /></td>
  49.  
  50. </tr>
  51. <tr>
  52. <td nowrap align="right">&nbsp;</td>
  53. <td><input type="submit" value="Enviar"></td>
  54. </tr>
  55. </table>
  56. <input type="hidden" name="user" value="<?php echo $row_user['user']; ?>">
  57. <input type="hidden" name="MM_insert" value="form1">
  58. </form>
  59. <p>&nbsp;</p>
Advertisement
Add Comment
Please, Sign In to add comment