-
Notifications
You must be signed in to change notification settings - Fork 0
/
formulario_pdo.php
45 lines (30 loc) · 1.56 KB
/
formulario_pdo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
include "DB.php";
$form = "";
$database = $_REQUEST['database'];
$tabla = $_REQUEST['tabla'];
//$database = "Autoescuela";
//$tabla = "alumno";
$sql = "select * from `information_schema`.`COLUMNS` where `TABLE_SCHEMA`='".$database."' AND table_name = '".$tabla."'";
$form.= "<pre>";
$form.= "<div class=\"formulario\"><br><br>";
$form.=" <h2>Insertar ".$tabla."</h2><br><br>";
$form.=" <form action=\"controles/Control_".$tabla.".php\" method=\"post\" name =\"forminsertar\" id=\"forminsertar\"><br><br>";
$q = DB::get()->query($sql, PDO::FETCH_ASSOC);
foreach ($q as $campos){
$form.=" <div class = \"registro_fila\"><br>";
$form.=" <div class = \"registro_form_eti\">".$campos["COLUMN_NAME"].":</div><br>";
$form.=" <div class = \"registro_form_campo\"><input type=\"text\" name =\"input".$campos["COLUMN_NAME"]."\" id=\"input".$campos["COLUMN_NAME"]."\"></div><br>";
$form.=" </div><br><br>";
}
$form.=" <div class=\"form_btns\"><br>";
$form.=" <button type=\"button\" class=\"form_btn\" id=\"btninsert\" onclick=\"insertar_modificar()\">Insertar</button><br>";
$form.=" <button type=\"reset\" class=\"form_btn\" id=\"btnborrar\" onclick=\"cancelar()\">Cancelar</button><br>";
$form.=" </div><br>";
$form.=" <input type=\"text\" id=\"inputid\" name =\"inputid\" value=\"0\"><br>";
$form.=" </form><br>";
$form.="</div><br>";
$form .= "</pre><br>";
echo $form;
//echo $insert;
?>