PHP Classes

File: add_action.php

Recommend this page to a friend!
  Classes of Mehmet Kidiman   Developbat PHP CRUD   add_action.php   Download  
File: add_action.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Developbat PHP CRUD
Show pages to manage table records using Bootstrap
Author: By
Last change:
Date: 3 years ago
Size: 1,371 bytes
 

Contents

Class file image Download
<?php

error_reporting
(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

include(
'config.php');
include(
'functions.php');


//var_dump($_POST);
if (isset($_POST['tableName'])) {

   
$inputType = 'text';
   
$columns = showColums($connect, $_POST['tableName']);
   
$countColumn = count($columns);
   
$rows = showRows($connect, $_POST['tableName']);

    echo
'<form id="addForm" method="post" action="">';
    echo
'<input type="hidden" name="table_name_order" value="'. $_POST['tableName'] .'"/>';
    echo
'<input type="hidden" name="action" value="add"/>';
    for (
$x = 0; $x < $countColumn; $x++){

       
$typePart = explode("(", $columns[$x][1]);
       
// echo $typePart[0];
       
$inputType = inputType($typePart[0]);

        if(
$columns[$x][3] == 'PRI'){

        }else{
            if(
$columns[$x][4] == 'NULL'){
               
$required = '';
            }else{
               
$required = 'required';
            }

            echo
'<div class="form-group">
         <label for="'
. $columns[$x][0] .'">'. $columns[$x][0] .' </label>';
            echo
'<input id="'. $columns[$x][0] .'" class="form-control" type="'.$inputType.'" name="'.$columns[$x][0].'" value="" '.$required.'/> </div>';

        }
    }

    echo
'<input type="submit" value="Add" class="form-control btn btn-success">';
    echo
'</form>';

}