Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- php code:
- $editFormAction = $_SERVER['PHP_SELF'];
- if (isset($_SERVER['QUERY_STRING'])) {
- $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
- }
- if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
- $insertSQL = sprintf("INSERT INTO reservations_clients (user, number_person, table, date) VALUES (%s, %s, %s, %s)",
- GetSQLValueString($_POST['user'], "text"),
- GetSQLValueString($_POST['number_person'], "int"),
- GetSQLValueString($_POST['table'], "int"),
- GetSQLValueString($_POST['date'], "text"),
- mysql_select_db($database_conexionbdd, $conexionbdd);
- $Result1 = mysql_query($insertSQL, $conexionbdd) or die(mysql_error());
- mysql_select_db($database_conexionbdd, $conexionbdd);
- $query_table = "SELECT * FROM tables";
- $table = mysql_query($query_table, $conexionbdd) or die(mysql_error());
- $row_table = mysql_fetch_assoc($table);
- $totalRows_tables = mysql_num_rows($table);
- the form:
- <form method="post" name="form1" action="<?php echo $editFormAction; ?>">
- <table align="center">
- <tr valign="baseline">
- <td nowrap align="right">Number_person:</td>
- <td><input type="text" name="Number of persons" value="" size="32"></td>
- </tr>
- <tr valign="baseline">
- <td nowrap align="right">table:</td>
- <td><select name="numero_mesa">
- <?php
- do {
- ?>
- <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>
- <?php
- } while ($row_table = mysql_fetch_assoc($table));
- ?>
- </select></td>
- <tr>
- <tr valign="baseline">
- <td nowrap align="right">date:</td>
- <td><input type="text" name="fecha" size="32" id="datepicker" /></td>
- </tr>
- <tr>
- <td nowrap align="right"> </td>
- <td><input type="submit" value="Enviar"></td>
- </tr>
- </table>
- <input type="hidden" name="user" value="<?php echo $row_user['user']; ?>">
- <input type="hidden" name="MM_insert" value="form1">
- </form>
- <p> </p>
Advertisement
Add Comment
Please, Sign In to add comment