Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Formularübergabe an die Mysql DB

Empfohlene Antworten

Veröffentlicht

Hallo, ich hab ein Formular erstellt mit DB zugriff, nur leider funzt es nicht. Meine html seite schaut folgender masen aus.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<!-- saved from url=(0065)file://H:\Homepage\www.von-Neuhaus.de\Kontakt\kontaktformular.htm -->

<HTML>

<HEAD>

<TITLE>Formulareingaben überprüfen</TITLE>

<META http-equiv=Content-Type content="text/html; charset=windows-1252">

<SCRIPT type=text/javascript>

<!--

function chkFormular()

{

if(document.Formular.vorname.value == "")

{

alert("Bitte geben Sie Ihren Vornamen ein!");

document.Formular.vorname.focus();

return false;

}

if(document.Formular.vorname.value == "")

{

alert("Bitte geben Sie ihren Vornamen ein!");

document.Formular.vorname.focus();

return false;

}

if(document.Formular.nachname.value == "")

{

alert("Bitte geben Sie Ihren Nachnamen ein!");

document.Formular.nachname.focus();

return false;

}

if(document.Formular.nachname.value == "")

{

alert("Bitte geben Sie ihren Nachnamen ein!");

document.Formular.nachname.focus();

return false;

}

if(document.Formular.strasse.value == "")

{

alert("Bitte geben Sie Ihre Strasse ein!");

document.Formular.strasse.focus();

return false;

}

if(document.Formular.strasse.value == "")

{

alert("Bitte geben Sie ihre Strasse ein!");

document.Formular.strasse.focus();

return false;

}

if(document.Formular.plz.value == "") {

alert("Bitte Ihr PLZ eingeben!");

document.Formular.plz.focus();

return false;

}

var chkZ = new RegExp("^[A-Za-z]{0,3}-?[0-9]{4,5}")

if(document.Formular.plz.value)){

alert("Die eingegebene PLZ ist ungültig!");

document.Formular.plz.focus();

document.Formular.plz.select();

return false;

}

if(document.Formular.ort.value == "") {

alert("Bitte Ihr ORT eingeben!");

document.Formular.ort.focus();

return false;

}

var chkZ = 1;

for(i=0;i<document.Formular.ort.value.length;++i)

if(document.Formular.ort.value.charAt(i) < "A"

|| document.Formular.ort.value.charAt(i) > "Z")

chkZ = -1;

if(chkZ == -1) {

alert("Bitte geben sie den richten Ort an!");

document.Formular.ort.focus();

return false;

}

if(document.Formular.tel_priv.value == "")

{

alert("Bitte geben Sie Ihrere priv. Tel. an!");

document.Formular.tel_priv.focus();

return false;

}

if(document.Formular.tel_priv.value == "")

{

alert("Bitte geben Sie ihre priv. Tel. ein!");

document.Formular.tel_priv.focus();

return false;

}

if(document.Formular.Mail.value == "")

{

alert("Bitte geben Sie Ihre E-Mail-Adresse ein!");

document.Formular.Mail.focus();

return false;

}

if(document.Formular.Mail.value.indexOf('@') == -1)

{

alert("Bitte geben Sie eine gültige E-Mailadresse ein!");

document.Formular.Mail.focus();

return false;

}

if(document.Formular.frage.value == "") {

alert("Hier haben Sie Platz für ihre Frage!");

document.Formular.frage.focus();

return false;

}

if(document.Formular.frage.value == "") {

alert("Hier haben Sie Platz für ihre Frage!");

document.Formular.frage.focus();

return false;

}

}

//-->

</SCRIPT>

<META content="Microsoft FrontPage 5.0" name=GENERATOR></HEAD>

<BODY text=#000000 bgColor=#eeeeee>

<BLOCKQUOTE>

<BLOCKQUOTE>

<BLOCKQUOTE>

<BLOCKQUOTE>

<H1 align=left><FONT size=4>  

             

<U><I><B>K o n t a k t f o r m u l a

r</B></I></U></FONT></H1></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE><!--<form name="Formular" action="http://selfaktuell.teamone.de/cgi-bin/formview.pl" method="post"

onSubmit="return chkFormular()"-->

<FORM name=Formular onsubmit="return chkFormular()" action=kontakt.php

method=post><PRE> </PRE><PRE><FONT size=4></FONT>

Vorname: <INPUT size=40 name=vorname></PRE>

<PRE>Nachname: <INPUT size=40 name=nachname></PRE>

<PRE>Straße: <INPUT size=40 name=strasse></PRE>

<PRE>PLZ: <!--webbot bot="Validation" s-data-type="Number" s-number-separators="x." b-value-required="TRUE" i-minimum-length="5" i-maximum-length="5" --><INPUT maxLength=5 size=7 name=plz> Wohnort: <INPUT size=40 name=ort></PRE>

<PRE>Tel.priv. <INPUT size=40 name=tel_priv></PRE>

<PRE>E-Mail: <INPUT size=40 name=mail>

<U>Ihr Frage:</U> </PRE><PRE> <TEXTAREA name=frage rows=8 cols=49></TEXTAREA></PRE><PRE> <INPUT type=submit value=senden> <INPUT type=reset value=löschen>

</PRE></FORM></BODY></HTML>

Meine php schaut wie folgt aus.

<html>

<head>

<title>Neue Seite 1</title>

</head>

<body>

<?php

$con=@mysql_connect("localhost","markus","123")or die ("Die Datenbankverbindung ist gescheitert");

$test="insert into kontakte (name, vorname, strasse, plz, ort, tel_priv, email, frage)

values ('$nachname','$vorname','$strasse','$plz','$ort','$tel_priv','$mail','$frage')";

$rs=mysql_db_query("Formular",$test,$con);

$ident=mysql_insert_id($con);

$rs=mysql_db_query("Formular","select * from kontakte where id = $ident", $con);

?> Sie haben folgende Daten eingegeben :

<br>

<br>

<table>

<tr><td>Nachname</td>

<td>

<?php echo mysql_result($rs,0,'name'); ?>

</td></tr>

<tr><td>Vorname:</td><td>

<?php echo mysql_result($rs,0,'vorname'); ?>

</td></tr>

<tr><td>Strasse:</td><td>

<?php echo mysql_result($rs,0,'strasse'); ?>

</td></tr>

<tr><td>PLZ:</td><td>

<?php echo mysql_result($rs,0,'plz'); ?>

</td></tr>

<tr><td>Ort:</td><td>

<?php echo mysql_result($rs,0,'ort');?>

</td></tr>

<tr><td>Tel.Privat</td><td>

<?php echo mysql_result($rs,0,'tel_priv'); ?>

</td></tr>

<tr><td>E-Mail:</td><td>

<?php echo mysql_result($rs,0,'email'); ?>

</td></tr>

<tr><td>Frage:</td><td>

<?php echo mysql_result($rs,0,'frage'); ?>

</td></tr></table>

<br>

<br>

Wir werden uns umgehend mit Ihnen in Verbindung setzen.

<br>

<br>

Vielen Dank

<?php

mysql_close($con);

?>

</body>

</html>

Ist eher ein PHP als ein mySQL Problem...

Ich schiebs mal in die Webserverprogrammierung....

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.