/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $id = 0; $secured = sanitize( $_POST ); { foreach ($data as $table => $value) { { foreach ($value as $k => $v) { $db_data[$table][] = "`$k` = '$v'"; } } } foreach ($db_data as $table => $values) { $values[] = '`modified` = NOW()'; } } { foreach ($data as $table => $value) { { foreach ($value as $k => $v) { $db_data[$table]['keys'][] = "`$k`"; $db_data[$table]['values'][] = "'$v'"; } } } foreach ($db_data as $table => $values) { { } mysql_query("INSERT INTO $table (" . implode(',', $values['keys']) . ") VALUES (" . implode(',', $values['values']) . ")"); } } ?> <form action="" method="post"> <input type="hidden" name="id" value="<?php echo $id ?>" /> <input type="text" name="data[users][name]" /> <input type="text" name="data[users][email]" /> <input type="text" name="data[users][address]" /> <input type="text" name="data[users][city]" /> <input type="text" name="data[users][zip]" /> <input type="text" name="data[users][web]" /> <input type="submit" name="save" value="Save" /> </form>