CRUD – Inventory Management System free download with Example files

Mit der Create - Read - Update - Delete (kurz CRUD) php Anwendung setzt Du eine einfache Warenverwaltung auf.

Inhalt

Einleitung

Ein simples online Warenbestands Management Sytsem. 

Mit diesem System ermöglichen wir es Artikel anzulegen, Artikel anzusehen, zu pflegen oder zu löschen. Ein weiteres highlight dieser simplen Anwendung ist der Export der bestehenden Daten via csv.

Für all jene die es nicht abwarten können – hier ist der Download mit allen Daten:

Dateien entpacken und mytable.sql importieren

Im ersten Schritt musstb Du die Dateien entpacken. In dem entpackten Folder findest Du die „mytable.sql“ Datei. Um diese in die Datenbank zu importieren öffnest du PHP-MyAdmin

Nach der Erfolgsmeldung kannst Du PHP-MyAdmin wieder schliessen und im Folder die config.php öffnen

Config.php – Datenbankverbindung etablieren

In diesem File musst Du nur die Zeilen ändern wo define steht. Ändere localhost zu Deiner Datenbank Adresse, User zu Datenbank user, Passwort und Datanbankname

<?php
/* Database credentials. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'user');
define('DB_PASSWORD', 'password');
define('DB_NAME', 'name');
 
/* Attempt to connect to MySQL database */
$link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
 
// Check connection
if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}
?> 

Index.php im Überblick

In der Index.php haben wir verschiedene Funktionalitäten vereint. Zum einem zwei Buttons die ganz nach oben scrollen oder nach unten.

Des weiteren einen Download csv Button. Und natürlich die Ausgabe der Datenbank

<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <title>Dashboard</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.js"></script>
    <style type="text/css">
        html {  scroll-behavior: smooth;}
        .wrapper{
            width: 100%;
            margin: 0 auto;
        }
        .page-header h2{
            margin-top: 0;
        }
        table tr td:last-child a{
            margin-right: 15px;
        }
        
        .abstand{min-height:50px!important;}
        
        
        .btn{min-height:40px; font-size:20px;}
       
        
    </style>
    <script type="text/javascript">
        $(document).ready(function(){
            $('[data-toggle="tooltip"]').tooltip();   
        });
    </script>
    

<script>
function exportTableToCSV(filename) {
    var csv = [];
    var rows = document.querySelectorAll("table tr");
    for (var i = 0; i < rows.length; i++) {
        var row = [], cols = rows[i].querySelectorAll("td, th");
        for (var j = 0; j < cols.length; j++) 
            row.push(cols[j].innerText);
        csv.push(row.join(","));        
    }
    // Download CSV file
    downloadCSV(csv.join("\n"), filename);
}
</script>
<script>
function downloadCSV(csv, filename) {
    var csvFile;
    var downloadLink;
    // CSV file
    csvFile = new Blob([csv], {type: "text/csv"});
    // Download link
    downloadLink = document.createElement("a");
    // File name
    downloadLink.download = filename;
    // Create a link to the file
    downloadLink.href = window.URL.createObjectURL(csvFile);
    // Hide download link
    downloadLink.style.display = "none";
    // Add the link to DOM
    document.body.appendChild(downloadLink);
    // Click download link
    downloadLink.click();
}
</script>

</head>
<body>
    <div class="wrapper">
        <div class="container-fluid">
        <div class="abstand" id="oben"></div>
            <div class="row" >
               
                <div class="col-md-4 rand">
                    <div>
                        <img src="assets/logo.png"  width="70" height="40">                       
                    </div>
                </div>
                <div class="col-md-4 rand">
                    <div>
                        <a href="#unten" class="btn btn-success pull-right">Nach unten scrollen</a>
                    </div>
                </div>    
                <div class="col-md-4 rand">
                    <div>
                         <a href="create.php" class="btn btn-success pull-right">Neue Ware anlegen</a>
                    </div>
                </div>
            </div>
            <div class="abstand" id="oben"></div>
            <div class="row">
                <div class="col-md-12">



                    <?php
                    // Include config file
                    require_once "config.php";
                    
                    // Attempt select query execution
                    $sql = "SELECT * FROM mytable";
                    if($result = mysqli_query($link, $sql)){
                        if(mysqli_num_rows($result) > 0){
                            echo "<table class='table table-bordered table-striped'>";
                                echo "<thead>";
                                    echo "<tr>";
                                        echo "<th>ID</th>";
                                        echo "<th>SKU</th>";
                                        echo "<th>Bezeichnung</th>";
                                        echo "<th>EK</th>";
                                        echo "<th>VK</th>";
                                        echo "<th>Beschreibung</th>";
                                    echo "</tr>";
                                echo "</thead>";
                                echo "<tbody>";
                                while($row = mysqli_fetch_array($result)){
                                    echo "<tr>";
                                        echo "<td>" . $row['id'] . "</td>";
                                        echo "<td>" . $row['SKU'] . "</td>";
                                        echo "<td>" . $row['Bezeichnung'] . "</td>";
                                        echo "<td>" . $row['EK'] . "</td>";
                                        echo "<td>" . $row['VK'] . "</td>";
                                        echo "<td>" . $row['Beschreibung'] . "</td>";
                                        echo "<td>";
                                            echo "<a href='read.php?id=". $row['id'] ."' title='View Record' data-toggle='tooltip'><span class='glyphicon glyphicon-eye-open'></span></a>";
                                            echo "<a href='update.php?id=". $row['id'] ."' title='Update Record' data-toggle='tooltip'><span class='glyphicon glyphicon-pencil'></span></a>";
                                            echo "<a href='delete.php?id=". $row['id'] ."' title='Delete Record' data-toggle='tooltip'><span class='glyphicon glyphicon-trash'></span></a>";
                                        echo "</td>";
                                    echo "</tr>";
                                }
                                echo "</tbody>";                            
                            echo "</table>";
                            // Free result set
                            mysqli_free_result($result);
                        } else{
                            echo "<p class='lead'><em>No records were found.</em></p>";
                        }
                    } else{
                        echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
                    }
 
                    // Close connection
                    mysqli_close($link);
                    ?>
                   
                   
                </div>
            </div> 
            <div class="row"><div class="col-md-4 pull-left"><button onclick="exportTableToCSV('Warenbestand.csv')" class="btn btn-success">Exportiere die Daten in ein csv</button></div><div class="col-md-4 pull-right"> <a href="#oben" class="btn btn-success pull-right">Nach oben scrollen</a></div></div>       
        </div>
    </div>
    
    <div class="abstand" id="unten"></div>

</body>
</html> 

Create.php – Artikel erstellen

<?php
// Include config file
require_once "config.php";

// Define variables and initialize with empty values
$SKU = $Bezeichnung = $EK = $VK = $Beschreibung = "";
$SKU_err = $Bezeichnung_err = $EK_err = $VK_err = $Beschreibung_err = "";

// Processing form data when form is submitted
if($_SERVER["REQUEST_METHOD"] == "POST"){

    // Validate SKU
    $input_SKU = trim($_POST["SKU"]);
    if(empty($input_SKU)){
        $SKU_err = "Hier die Artikelnummer eintragen";
    } else{
        $SKU = $input_SKU;
    }

    // Validate Bezeichnung
    $input_Bezeichnung = trim($_POST["Bezeichnung"]);
    if(empty($input_Bezeichnung)){
        $Bezeichnung_err = "Bezeichnung";     
    } else{
        $Bezeichnung = $input_Bezeichnung;
    }

    // Validate EK
    $input_EK = trim($_POST["EK"]);
    if(empty($input_EK)){
        $EK_err = "EK";     
    } else{
        $EK = $input_EK;
    }

    // Validate VK
    $input_VK = trim($_POST["VK"]);
    if(empty($input_VK)){
        $VK_err = "VK";     
    } else{
        $VK = $input_VK;
    }

    // Validate Beschreibung
    $input_Beschreibung = trim($_POST["Beschreibung"]);
    if(empty($input_Beschreibung)){
        $Beschreibung_err = "Beschreibung";     
    } else{
        $Beschreibung = $input_Beschreibung;
    }

    // Check input errors before inserting in database
    if(empty($SKU_err) && empty($Bezeichnung_err) && empty($EK_err) && empty($VK_err) && empty($Beschreibung_err)){
        // Prepare an insert statement
        $sql = "INSERT INTO mytable (SKU, Bezeichnung, EK, VK, Beschreibung) VALUES (?, ?, ?, ?, ?)";

        if($stmt = mysqli_prepare($link, $sql)){
            // Bind variables to the prepared statement as parameters
            mysqli_stmt_bind_param($stmt, "sssss", $param_SKU, $param_Bezeichnung, $param_EK, $param_VK, $param_Beschreibung);

            // Set parameters

            $param_SKU = $SKU;
            $param_Bezeichnung = $Bezeichnung;
            $param_EK = $EK;
            $param_VK = $VK;
            $param_Beschreibung = $Beschreibung;

            // Attempt to execute the prepared statement
            if(mysqli_stmt_execute($stmt)){
                // Records created successfully. Redirect to landing page
                header("location: index.php");
                exit();
            } else{
                echo "Something went wrong. Please try again later.";
            }
        }

        // Close statement
        mysqli_stmt_close($stmt);
    }

    // Close connection
    mysqli_close($link);
}
?>

<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <title>Create Record</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
    <style type="text/css">
        .wrapper{
            width: 100%;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    <div class="wrapper">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="page-header">
                        <h2>Artikel erstellen</h2>
                    </div>
                    <p>Fülle bitte alle Felder aus, wenn Du für ein Feld keinen Wert hast gib einen Platzhalter ein</p>
                    <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">

                        <div class="form-group <?php echo (!empty($SKU_err)) ? 'has-error' : ''; ?>">
                            <label>Artikelnummer</label>
                            <input type="text" name="SKU" class="form-control" value="<?php echo $SKU; ?>">
                            <span class="help-block"><?php echo $SKU_err;?></span>
                        </div>
                        <div class="form-group <?php echo (!empty($Bezeichnung_err)) ? 'has-error' : ''; ?>">
                            <label>Bezeichnung</label>
                            <input type="text" name="Bezeichnung" class="form-control" value="<?php echo $Bezeichnung; ?>">
                            <span class="help-block"><?php echo $Bezeichnung_err;?></span>
                        </div>
                        <div class="form-group <?php echo (!empty($EK_err)) ? 'has-error' : ''; ?>">
                            <label>EK</label>
                            <input type="text" name="EK" class="form-control" value="<?php echo $EK; ?>">
                            <span class="help-block"><?php echo $EK_err;?></span>
                        </div>
                        <div class="form-group <?php echo (!empty($VK_err)) ? 'has-error' : ''; ?>">
                            <label>VK</label>
                            <input type="text" name="VK" class="form-control" value="<?php echo $VK; ?>">
                            <span class="help-block"><?php echo $VK_err;?></span>
                        </div>
                        <div class="form-group <?php echo (!empty($Beschreibung_err)) ? 'has-error' : ''; ?>">
                            <label>Beschreibung</label>
                            <input type="text" name="Beschreibung" class="form-control" value="<?php echo $Beschreibung; ?>">
                            <span class="help-block"><?php echo $Beschreibung_err;?></span>
                        </div>
                        <input type="submit" class="btn btn-primary" value="Submit">
                        <a href="index.php" class="btn btn-default">Cancel</a>
                    </form>
                </div>
            </div>        
        </div>
    </div>
</body>
</html> 

Delete.php – Artikel löschen

<?php
// Process delete operation after confirmation
if(isset($_POST["id"]) && !empty($_POST["id"])){
    // Include config file
    require_once "config.php";
    
    // Prepare a delete statement
    $sql = "DELETE FROM mytable WHERE id = ?";
    
    if($stmt = mysqli_prepare($link, $sql)){
        // Bind variables to the prepared statement as parameters
        mysqli_stmt_bind_param($stmt, "i", $param_id);
        
        // Set parameters
        $param_id = trim($_POST["id"]);
        
        // Attempt to execute the prepared statement
        if(mysqli_stmt_execute($stmt)){
            // Records deleted successfully. Redirect to landing page
            header("location: index.php");
            exit();
        } else{
            echo "Oops! Something went wrong. Please try again later.";
        }
    }
     
    // Close statement
    mysqli_stmt_close($stmt);
    
    // Close connection
    mysqli_close($link);
} else{
    // Check existence of id parameter
    if(empty(trim($_GET["id"]))){
        // URL doesn't contain id parameter. Redirect to error page
        header("location: error.php");
        exit();
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Artikel löschen</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
    <style type="text/css">
        .wrapper{
            width: 500px;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    <div class="wrapper">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="page-header">
                        <h1>Artikel LÖSCHEN</h1>
                    </div>
                    <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
                        <div class="alert alert-danger fade in">
                            <input type="hidden" name="id" value="<?php echo trim($_GET["id"]); ?>"/>
                            <p>Bist Du Dir sicher? Gelöscht ist gelöscht!</p><br>
                            <p>
                                <input type="submit" value="Yes" class="btn btn-danger">
                                <a href="index.php" class="btn btn-default">No</a>
                            </p>
                        </div>
                    </form>
                </div>
            </div>        
        </div>
    </div>
</body>
</html> 

Error.php – Fehlermeldungen

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Error</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
    <style type="text/css">
        .wrapper{
            width: 750px;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    <div class="wrapper">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="page-header">
                        <h1>Invalid Request</h1>
                    </div>
                    <div class="alert alert-danger fade in">
                        <p>Sorry, you've made an invalid request. Please <a href="index.php" class="alert-link">go back</a> and try again.</p>
                    </div>
                </div>
            </div>        
        </div>
    </div>
</body>
</html> 

Read.php – Einzelartikel Ansicht

<?php
// Check existence of id parameter before processing further
if(isset($_GET["id"]) && !empty(trim($_GET["id"]))){
    // Include config file
    require_once "config.php";
    
    // Prepare a select statement
    $sql = "SELECT * FROM mytable WHERE id = ?";
    
    if($stmt = mysqli_prepare($link, $sql)){
        // Bind variables to the prepared statement as parameters
        mysqli_stmt_bind_param($stmt, "i", $param_id);
        
        // Set parameters
        $param_id = trim($_GET["id"]);
        
        // Attempt to execute the prepared statement
        if(mysqli_stmt_execute($stmt)){
            $result = mysqli_stmt_get_result($stmt);
    
            if(mysqli_num_rows($result) == 1){
                /* Fetch result row as an associative array. Since the result set
                contains only one row, we don't need to use while loop */
                $row = mysqli_fetch_array($result, MYSQLI_ASSOC);
                
                // Retrieve individual field value
                $SKU = $row["SKU"];
                $Bezeichnung = $row["Bezeichnung"];
                $EK = $row["EK"];
                $VK = $row["VK"];
                $Beschreibung = $row["sBeschreibung"];
            } else{
                // URL doesn't contain valid id parameter. Redirect to error page
                header("location: error.php");
                exit();
            }
            
        } else{
            echo "Oops! Something went wrong. Please try again later.";
        }
    }
     
    // Close statement
    mysqli_stmt_close($stmt);
    
    // Close connection
    mysqli_close($link);
} else{
    // URL doesn't contain id parameter. Redirect to error page
    header("location: error.php");
    exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>View Record</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
    <style type="text/css">
        .wrapper{
            width: 500px;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    <div class="wrapper">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="page-header">
                        <h1>Eintrag ansehen</h1>
                    </div>
                    <div class="form-group">
                        <label>SKU</label>
                        <p class="form-control-static"><?php echo $row["SKU"]; ?></p>
                    </div>
                    <div class="form-group">
                        <label>Bezeichnung</label>
                        <p class="form-control-static"><?php echo $row["Bezeichnung"]; ?></p>
                    </div>
                    <div class="form-group">
                        <label>EK</label>
                        <p class="form-control-static"><?php echo $row["EK"]; ?></p>
                    </div>
                    <div class="form-group">
                        <label>VK</label>
                        <p class="form-control-static"><?php echo $row["VK"]; ?></p>
                    </div>
                    <div class="form-group">
                        <label>Beschreibung</label>
                        <p class="form-control-static"><?php echo $row["Beschreibung"]; ?></p>
                    </div>
                    <p><a href="index.php" class="btn btn-primary">Back</a></p>
                </div>
            </div>        
        </div>
    </div>
</body>
</html> 

Update.php – Artikel aktualisiieren

<?php
// Include config file
require_once "config.php";
 
// Define variables and initialize with empty values
$SKU = $Bezeichnung = $EK = $VK = $Beschreibung = "";
$SKU_err = $Bezeichnung_err = $EK_err = $VK_err = $Beschreibung_err = "";
 
// Processing form data when form is submitted
if(isset($_POST["id"]) && !empty($_POST["id"])){
    // Get hidden input value
    $id = $_POST["id"];
    
   
    // Validate SKU
    $input_SKU = trim($_POST["SKU"]);
    if(empty($input_SKU)){
        $SKU_err = "Hier die Artikelnummer eintragen";
    } else{
        $SKU = $input_SKU;
    }

    // Validate Bezeichnung
    $input_Bezeichnung = trim($_POST["Bezeichnung"]);
    if(empty($input_Bezeichnung)){
        $Bezeichnung_err = "Bezeichnung";     
    } else{
        $Bezeichnung = $input_Bezeichnung;
    }

    // Validate EK
    $input_EK = trim($_POST["EK"]);
    if(empty($input_EK)){
        $EK_err = "EK";     
    } else{
        $EK = $input_EK;
    }

    // Validate VK
    $input_VK = trim($_POST["VK"]);
    if(empty($input_VK)){
        $VK_err = "VK";     
    } else{
        $VK = $input_VK;
    }

    // Validate Beschreibung
    $input_Beschreibung = trim($_POST["Beschreibung"]);
    if(empty($input_Beschreibung)){
        $Beschreibung_err = "Beschreibung";     
    } else{
        $Beschreibung = $input_Beschreibung;
    }
    
    // Check input errors before inserting in database
    if(empty($SKU_err) && empty($Bezeichnung_err) && empty($EK_err) && empty($VK_err) && empty($Beschreibung_err)){
        // Prepare an update statement
        $sql = "UPDATE mytable SET SKU=?, Bezeichnung=?, EK=?, VK=?, Beschreibung=? WHERE id=?";
         
        if($stmt = mysqli_prepare($link, $sql)){
            // Bind variables to the prepared statement as parameters
            mysqli_stmt_bind_param($stmt, "ssssi", $param_SKU, $param_Bezeichnung, $param_EK, $param_VK, $param_Beschreibung,  $param_id);
            
            // Set parameters
            $param_SKU = $SKU;
            $param_Bezeichnung = $Bezeichnung;
            $param_EK = $EK;
            $param_VK = $VK;
            $param_BeschreibungK = $BeschreibungK;
            $param_id = $id;
            
            // Attempt to execute the prepared statement
            if(mysqli_stmt_execute($stmt)){
                // Records updated successfully. Redirect to landing page
                header("location: index.php");
                exit();
            } else{
                echo "Something went wrong. Please try again later.";
            }
        }
         
        // Close statement
        mysqli_stmt_close($stmt);
    }
    
    // Close connection
    mysqli_close($link);
} else{
    // Check existence of id parameter before processing further
    if(isset($_GET["id"]) && !empty(trim($_GET["id"]))){
        // Get URL parameter
        $id =  trim($_GET["id"]);
        
        // Prepare a select statement
        $sql = "SELECT * FROM employees WHERE id = ?";
        if($stmt = mysqli_prepare($link, $sql)){
            // Bind variables to the prepared statement as parameters
            mysqli_stmt_bind_param($stmt, "i", $param_id);
            
            // Set parameters
            $param_id = $id;
            
            // Attempt to execute the prepared statement
            if(mysqli_stmt_execute($stmt)){
                $result = mysqli_stmt_get_result($stmt);
    
                if(mysqli_num_rows($result) == 1){
                    /* Fetch result row as an associative array. Since the result set
                    contains only one row, we don't need to use while loop */
                    $row = mysqli_fetch_array($result, MYSQLI_ASSOC);
                    
                    // Retrieve individual field value
                    $SKU = $row["SKU"];
                    $Bezeichnung = $row["Bezeichnung"];
                    $EK = $row["EK"];
                    $VK = $row["VK"];
                    $Beschreibung= $row["Beschreibung"];
                } else{
                    // URL doesn't contain valid id. Redirect to error page
                    header("location: error.php");
                    exit();
                }
                
            } else{
                echo "Oops! Something went wrong. Please try again later.";
            }
        }
        
        

        // Close statement
        mysqli_stmt_close($stmt);
        
        // Close connection
        mysqli_close($link);
    }  else{
        // URL doesn't contain id parameter. Redirect to error page
        header("location: error.php");
        exit();
    }
}




?>
 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Update Record</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
    <style type="text/css">
        .wrapper{
            width: 100%;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    <div class="wrapper">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="page-header">
                        <h2>Artikel updaten</h2>
                       


                    </div>
                    <p>Please edit the input values and submit to update the record.</p>
                    <form action="<?php echo htmlspecialchars(basename($_SERVER['REQUEST_URI'])); ?>" method="post">
                        <div class="form-group <?php echo (!empty($SKU_err)) ? 'has-error' : ''; ?>">
                            <label>SKU</label>
                            <input type="text" name="SKU" class="form-control" value="<?php echo $SKU; ?>" placeholder="<?php echo $id; ?>">
                            <span class="help-block"><?php echo $SKU_err;?></span>
                        </div>
                        <div class="form-group <?php echo (!empty($Bezeichnung_err)) ? 'has-error' : ''; ?>">
                            <label>Bezeichnung</label>
                            <textarea name="Bezeichnung" class="form-control" value="<?php echo $VK; ?>"> </textarea>
                            <span class="help-block"><?php echo $Bezeichnung_err;?></span>
                        </div>
                        <div class="form-group <?php echo (!empty($EK_err)) ? 'has-error' : ''; ?>">
                            <label>EK</label>
                            <input type="text" name="EK" class="form-control" value="<?php echo $EK; ?>">
                            <span class="help-block"><?php echo $EK_err;?></span>
                        </div>
                        <div class="form-group <?php echo (!empty($VK_err)) ? 'has-error' : ''; ?>">
                            <label>VK</label>
                            <input type="text" name="VK" class="form-control" value="<?php echo $VK; ?>">
                            <span class="help-block"><?php echo $VK_err;?></span>
                        </div>
                        <div class="form-group <?php echo (!empty($Beschreibung_err)) ? 'has-error' : ''; ?>">
                            <label>Beschreibung</label>
                            <input type="text" name="Beschreibung" class="form-control" value="<?php echo $Beschreibung; ?>">
                            <span class="help-block"><?php echo $Beschreibung_err;?></span>
                        </div>
                        <input type="hidden" name="id" value="<?php echo $id; ?>"/>
                        <input type="submit" class="btn btn-primary" value="Submit">
                        <a href="index.php" class="btn btn-default">Cancel</a>
                    </form>
                </div>
            </div>        
        </div>
    </div>
</body>
</html> 

Finales Produkt – Crud in Action

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.