Hallo doschni!
Danke für die Antwort!
Die Buttons haben bereits unterschiedliche Namen, daran kann's also nicht liegen.
Diesmal will ich mit dem Code nicht geizen. Im linken div container werden 3 Buttons erzeugt. Nach dem Anklicken soll für jeden Button in div 2 (rechts) ein anderes Formular geladen werden, das am Ende selbstverständlich bestätigt werden muss:
HTML-Code:
<html>
<head>
<title>Konfiguration</title>
<link href="../stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="main">
<div id="banner">
<h1>Konfiguration</h1>
</div>
<div id="menu">
<form action="create_button.php" method="post" />
<input type="submit" name="add" value="Hinzufügen" class="mbutton">
<input type="submit" name="remove" value="Entfernen" class="mbutton">
<input type="submit" name="chorder" value="Ordnen" class="mbutton">
</div>
<div id="switches">
PHP-Code:
<?php
if(isset($_POST['add'])){
include 'add.php';
}
elseif(isset($_POST['remove'])){
include 'remove.php';
}
elseif(isset($_POST['chorder'])){
include 'chorder.php';
}
?>
HTML-Code:
</div>
</div>
</body>
Hier wird das Formular erzeugt welches nach einem Klick auf hinzufügen angezeigt werden soll. db_connect.php is eine von mir erstellte Klasse die eine Verbindung zur MySql-Datenbank aufbaut und dort die eingegebenen Werte einträgt.
HTML-Code:
<html>
<body>
<h1>Ein neues Gerät hinzufügen</h1>
<form action="add.php" method="post" />
<table id="formtable">
<tr>
<td>
Neues Gerät
</td>
<td>
<input type="text" name="nb_name" class="textinput">
</td>
<tr>
<td>
Raum
</td>
<td>
<input type="text" name="nb_group" class="textinput">
</td>
</tr>
<tr>
<td>
Befehl
</td>
<td>
<input type="text" name="nb_command" class="textinput">
</td>
<tr>
<td>
</td>
<td>
<input type="submit" name="addsubmit" value="Gerät hinzufügen" class="submit">
</td>
</tr>
</table>
PHP-Code:
<?php
if(isset($_POST['addsubmit'])){
include('db_connect.php'); //MySql-Klasse einbinden
$read = db_connect("INSERT INTO sw_switches(id, name, swgroup, status, position, command) VALUES (NULL, 'test', 'wz', '0', '1', '01010')", "write"); //Neues Gerät hinzufügen
var_dump($read);
}
?>
HTML-Code:
</body>
</html>