Sorry hier die
funktionierende Version:
index.php
PHP-Code:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Funktionierende Konfiguration</title>
</head>
<body>
<div id="main">
<div id="banner">
<h1>Konfiguration</h1>
</div>
<div id="menu">LINKS
<form name="links">
<input type="submit" name="add" value="Hinzufuegen" class="mbutton" formaction="" formmethod="post">
<input type="submit" name="remove" value="Entfernen" class="mbutton" formaction="" formmethod="post">
<input type="submit" name="chorder" value="Ordnen" class="mbutton" formaction="" formmethod="post">
</form>
</div>
<div id="switches">RECHTS<br>
<?php
if(isset($_POST['addsubmit'])){
echo $_POST['nb_name'];
echo $_POST['nb_group'];
echo $_POST['nb_command'];
include 'db_connect.php'; //MySql-Klasse einbinden
mysql_query("INSERT INTO sw_switches(id, name, swgroup, status, position, command) VALUES (NULL, 'test', 'wz', '0', '1', '01010')")
or die(mysql_error());
// Hier Datenbank wieder schliessen, je nachdem, was in der db_connect.php steht z.B.
// mysql_close($con);
}
if(isset($_POST['add'])){
include 'add.php';
}
elseif(isset($_POST['remove'])){
include 'add2.php';
}
elseif(isset($_POST['chorder'])){
include 'chorder.php';
}
?>
</div>
</div>
</body>
</html>
add.php
PHP-Code:
<h1>Ein neues Gerät hinzufügen</h1>
<form name="rechts">
<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" formaction="" formmethod="post">
</td>
</tr>
</table>
</form>
Gruss und gut Nacht