also ich hab gestern mein erstes Formular mit MySQL und PHP versucht und hat soweit alles funktioniert
Aber das speichern klappt nicht es kommen immer die Fehlermeldungen:
Notice: Undefined variable: z in D:\hp\anmeldung\anmeldung.php on line 7
Notice: Undefined variable: v in D:\hp\anmeldung\anmeldung.php on line 7
Notice: Undefined variable: p in D:\hp\anmeldung\anmeldung.php on line 7
Notice: Undefined variable: o in D:\hp\anmeldung\anmeldung.php on line 7
Notice: Undefined variable: a in D:\hp\anmeldung\anmeldung.php on line 7
Notice: Undefined variable: t in D:\hp\anmeldung\anmeldung.php on line 7
Hier die datein die ich geschrieben hab:
anmeldung.htm:
<html>
<head>
<title>Anmeldung WING</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body bgcolor="#000000">
<form method="POST" action="anmeldung.php">
<table width="49%" height="225" border="1" bgcolor="#000000">
<tr>
<td width="44%"><font color="#00FFFF">Nachname:</font></td>
<td width="56%"><input type="text" name="z" size="20"></td>
</tr>
<tr>
<td width="44%"><font color="#00FFFF">Vorname:</font></td>
<td width="56%"><input type="text" name="v" size="20"></td>
</tr>
<tr>
<td width="44%"><font color="#00FFFF">PLZ:</font></td>
<td width="56%"><input type="text" name="p" size="20"></td>
</tr>
<tr>
<td width="44%"><font color="#00FFFF">Ort:</font></td>
<td width="56%"><input type="text" name="o" size="20"></td>
</tr>
<tr>
<td width="44%"><font color="#00FFFF">Adresse:</font></td>
<td width="56%"><input type="text" name="a" size="20"></td>
</tr>
<tr>
<td width="44%"><font color="#00FFFF">TelefonNr.:</font></td>
<td width="56%"><input type="text" name="t" size="20"></td>
</tr>
<tr>
<td width="44%"> </td>
<td width="56%"><input type="submit" value="Abschicken" name="B1"></td>
</tr>
</table>
</form>
</body>
</html>
anmeldung.php:
<?php
include("config.inc.php");
?>
<?php
$oConn = mysql_connect($dbhost,$db_ben,$db_pwd);
mysql_select_db($dbname,$oConn);
mysql_query(("insert into $tab_h(Z, V, P, O, A, T) values('$z','$v','$p','$o','$a','$t')"),$oConn) or die("Fehler beim Speichern");
mysql_close($oConn);
?>
<html>
<head>
<title>Fromular</title>
</head>
<body>
<p align="center"><font color="#000000">Daten erfolgreich gespeichert! </font></p>
</body>
</html>
config.inc.php:
<?
$dbhost = "localhost";
$db_ben = "root";
$db_pwd = "";
$dbname = "test";
$tab_h="anmeldung";
?>
Und hier die Datenbakdatei mit der ich die Datenbank angelegt hab
CREATE TABLE anmeldung (
Nr int(11) NOT NULL auto_increment,
V varchar(250),
Z varchar(250),
A varchar(250),
P varchar(250),
O varchar(250),
T varchar(250),
PRIMARY KEY (Nr)
);
Sag schon jetzt mal danke für die Hilfe.
Aber das speichern klappt nicht es kommen immer die Fehlermeldungen:
Notice: Undefined variable: z in D:\hp\anmeldung\anmeldung.php on line 7
Notice: Undefined variable: v in D:\hp\anmeldung\anmeldung.php on line 7
Notice: Undefined variable: p in D:\hp\anmeldung\anmeldung.php on line 7
Notice: Undefined variable: o in D:\hp\anmeldung\anmeldung.php on line 7
Notice: Undefined variable: a in D:\hp\anmeldung\anmeldung.php on line 7
Notice: Undefined variable: t in D:\hp\anmeldung\anmeldung.php on line 7
Hier die datein die ich geschrieben hab:
anmeldung.htm:
<html>
<head>
<title>Anmeldung WING</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body bgcolor="#000000">
<form method="POST" action="anmeldung.php">
<table width="49%" height="225" border="1" bgcolor="#000000">
<tr>
<td width="44%"><font color="#00FFFF">Nachname:</font></td>
<td width="56%"><input type="text" name="z" size="20"></td>
</tr>
<tr>
<td width="44%"><font color="#00FFFF">Vorname:</font></td>
<td width="56%"><input type="text" name="v" size="20"></td>
</tr>
<tr>
<td width="44%"><font color="#00FFFF">PLZ:</font></td>
<td width="56%"><input type="text" name="p" size="20"></td>
</tr>
<tr>
<td width="44%"><font color="#00FFFF">Ort:</font></td>
<td width="56%"><input type="text" name="o" size="20"></td>
</tr>
<tr>
<td width="44%"><font color="#00FFFF">Adresse:</font></td>
<td width="56%"><input type="text" name="a" size="20"></td>
</tr>
<tr>
<td width="44%"><font color="#00FFFF">TelefonNr.:</font></td>
<td width="56%"><input type="text" name="t" size="20"></td>
</tr>
<tr>
<td width="44%"> </td>
<td width="56%"><input type="submit" value="Abschicken" name="B1"></td>
</tr>
</table>
</form>
</body>
</html>
anmeldung.php:
<?php
include("config.inc.php");
?>
<?php
$oConn = mysql_connect($dbhost,$db_ben,$db_pwd);
mysql_select_db($dbname,$oConn);
mysql_query(("insert into $tab_h(Z, V, P, O, A, T) values('$z','$v','$p','$o','$a','$t')"),$oConn) or die("Fehler beim Speichern");
mysql_close($oConn);
?>
<html>
<head>
<title>Fromular</title>
</head>
<body>
<p align="center"><font color="#000000">Daten erfolgreich gespeichert! </font></p>
</body>
</html>
config.inc.php:
<?
$dbhost = "localhost";
$db_ben = "root";
$db_pwd = "";
$dbname = "test";
$tab_h="anmeldung";
?>
Und hier die Datenbakdatei mit der ich die Datenbank angelegt hab
CREATE TABLE anmeldung (
Nr int(11) NOT NULL auto_increment,
V varchar(250),
Z varchar(250),
A varchar(250),
P varchar(250),
O varchar(250),
T varchar(250),
PRIMARY KEY (Nr)
);
Sag schon jetzt mal danke für die Hilfe.
Zuletzt bearbeitet: