Zurück   Flashforum > Flash und Server > PHP und MySQL

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 05-09-2011, 15:10   #16 (permalink)
Inventar
 
Benutzerbild von Nightflyer
 
Registriert seit: Jul 2002
Beiträge: 6.882
na dann schieb mal deinen aktuellen Code rüber PHP + JS!!

Edit: Grad nen Fehler entdeckt:
HTML-Code:
<form action="form/contact_form.php" method="POST" id="myform'>
Doppeltes Anführungszeichen am Schluss, sonst führt das genau dazu dass nix funktioniert
__________________
(\__/)
(='.'=)
(")_(")

Geändert von Nightflyer (05-09-2011 um 15:12 Uhr)
Nightflyer ist offline   Mit Zitat antworten
Alt 05-09-2011, 17:59   #17 (permalink)
Neuer User
 
Registriert seit: Jun 2011
Beiträge: 21
Hallo,

das mit dem Submitbutton ist ne ganz komische Sache -> ich hab ihn jetzt an eine andere Position gesetzt und er funktioniert einwandfrei...

das mit dem Script versteh ich aber noch nicht - es kommen keine popup-meldungen.
bastooo ist offline   Mit Zitat antworten
Alt 05-09-2011, 18:56   #18 (permalink)
Neuer User
 
Registriert seit: Jun 2011
Beiträge: 21
Das mit dem einfachen ' ist mir eh gleich aufgefallen

der aktuelle Code:

in der contact_form.php hab ich nichts geändert.

contact.inc.php:

PHP-Code:
<script type="text/javascript">

    $(
document).ready( function(){

        $(
'#myform').submit( function(){
            
            
event.preventDefault();
            $.
post'form/contact_form.php', $(this).serialize(), function( data ){

                
alertdata );

            }

        });


    });


</script>

<div class="content2">

<b>CONTACT:</b></br>
</br>

<form action="form/contact_form.php" method="POST" id="myform">
<fieldset>
<p>
<input type="text" name="Vorname" id="Vorname" value="first name" size="20" style="background-color:#eee; border: 1px solid #ccc; margin-bottom: 10px;"/>
</p>
<p>
<input type="text" name="Nachname" id="Nachname" value="last name" size="20" style="background-color:#eee; border: 1px solid #ccc; margin-bottom: 10px;"/>
</p>
<p>
<input type="text" name="Email" id="Email" value="email" size="20" style="background-color:#eee; border: 1px solid #ccc; margin-bottom: 10px;"/>
</p>
<p>
<input type="text" name="Betreff" id="Betreff" value="subject" size="20" style="background-color:#eee; border: 1px solid #ccc; margin-bottom: 10px;"/>
</p>

<textarea name="Text" id="Text" cols="50" rows="10" style="font-family:Verdana, Geneva, sans-serif; background-color:#eee; border: 1px solid #ccc; margin-bottom: 10px;">text...</textarea>

<input type="submit" id="Submit" name="Submit" value="Submit" style="margin-left:35px; background-color:#eee; border: 1px solid #ccc; margin-top: 10px; padding: 3px 6px" />

</fieldset>
</form>

</div> 
die script source:

Code:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
hab ich in den kopf von meiner index.php geschrieben.
bastooo ist offline   Mit Zitat antworten
Alt 05-09-2011, 22:24   #19 (permalink)
Inventar
 
Benutzerbild von Nightflyer
 
Registriert seit: Jul 2002
Beiträge: 6.882
Ok, offenbar funktionierte das Abfangen der Submit-Aktion des Formulars so nicht. Drum hab ich den Submit-Input durch einen Button ersetzt der die Funktion ausführt. So gehts tadellos:

HTML-Code:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Test</title>
    <script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>

	<style type="text/css">
		*{
			margin: 0;
			padding: 0;
			border: none;
		}

    </style>
	
	<script type="text/javascript">
    
    $(document).ready( function(){

        $('#Submit').click( function( event ){
            
            $.post( 'contact_form.php', $('#myform').serialize(), function( data ){

                alert( data );

            });
            
        });
        
    });
        

	</script>

</head>
<body>

   <div class="content2">

<b>CONTACT:</b></br>
</br>

<form action="contact_form.php" method="POST" id="myform">
<fieldset>
<p>
<input type="text" name="Vorname" id="Vorname" value="first name" size="20" style="background-color:#eee; border: 1px solid #ccc; margin-bottom: 10px;"/>
</p>
<p>
<input type="text" name="Nachname" id="Nachname" value="last name" size="20" style="background-color:#eee; border: 1px solid #ccc; margin-bottom: 10px;"/>
</p>
<p>
<input type="text" name="Email" id="Email" value="email" size="20" style="background-color:#eee; border: 1px solid #ccc; margin-bottom: 10px;"/>
</p>
<p>
<input type="text" name="Betreff" id="Betreff" value="subject" size="20" style="background-color:#eee; border: 1px solid #ccc; margin-bottom: 10px;"/>
</p>

<textarea name="Text" id="Text" cols="50" rows="10" style="font-family:Verdana, Geneva, sans-serif; background-color:#eee; border: 1px solid #ccc; margin-bottom: 10px;">text...</textarea>

<button type="button" id="Submit" name="Submit" value="Submit" style="margin-left:35px; background-color:#eee; border: 1px solid #ccc; margin-top: 10px; padding: 3px 6px" >Submit</button>

</fieldset>
</form>

</div> 

</body>
</html> 
PHP-Code:
<?php

$Empfaenger 
"ghgfhh@fgfghthh.com";

if (empty(
$_POST['Vorname']) || empty($_POST['Nachname']) || empty($_POST['Email']) ||
    empty(
$_POST['Betreff']) || empty($_POST['Text']))
{
    
$my_msg "Fill up all the fields!";
} else
{
    
$Mailnachricht "Sie haben eine Anfrage über ihr 
        Kontaktformular erhalten:\n\n"
;
    while (list(
$Formularfeld$Wert) = each($_POST))
    {
        if (
$Formularfeld != "Submit")
        {
            
$Mailnachricht .= $Formularfeld ": " $Wert "\n";
        }
    }
    
$Mailnachricht .= "\nDatum/Zeit: ";
    
$Mailnachricht .= date("d.m.Y H:i:s");
    
$Mailbetreff "Contact: ";
    
$Mailbetreff .= $_POST['Betreff'];
    
mail($Empfaenger$Mailbetreff$Mailnachricht"From: " $_POST['Email']);

    
$my_msg "Your message has been sent!";

}

echo 
$my_msg;

?>
__________________
(\__/)
(='.'=)
(")_(")
Nightflyer ist offline   Mit Zitat antworten
Alt 06-09-2011, 14:55   #20 (permalink)
Neuer User
 
Registriert seit: Jun 2011
Beiträge: 21
ich bin noch am werken. es hat auch einmal schon fast funktioniert, aber ich glaub ich muss überall mal ein bisschen Ordnung in meine Codes bringen damit ich mich auch wieder auskenn.

thx
bastooo ist offline   Mit Zitat antworten
Alt 08-09-2011, 11:27   #21 (permalink)
Neuer User
 
Registriert seit: Jun 2011
Beiträge: 21
Hallo nightflyer!

Vielleicht bist du so nett und schaust nochmal über mein Script...

ich hab jetzt parallel 2 Arten probiert, aber ich denk dass eher diese zum Ziel fürhen wird. Hast du es ausprobiert und hat es funktioniert?

contact.inc.php:
HTML-Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

	<script type="text/javascript">
    
    $(document).ready( function(){

        $('#Submit').click( function( event ){
            
            $.post( 'contact_form.php', $('#myform').serialize(), function( data ){

                alert( data );

            });
            
        });
        
    });

	</script>

</head>


<body>
<div class="content2">

<b>CONTACT:</b><br />
<br />

<form action="form/contact_form.php" name="myform" id="myform" method="post" enctype="multipart/form-data">

<fieldset>
<input type="text" name="Vorname" value="first name" tabindex="1" size="20" style="background-color:#eee; border: 1px solid #ccc; margin-bottom: 10px;" /><br />
<input type="text" name="Nachname" value="last name" tabindex="2" size="20" style="background-color:#eee; border: 1px solid #ccc; margin-bottom: 10px;" /><br />
<input type="text" name="Email" value="email" tabindex="3" size="20" style="background-color:#eee; border: 1px solid #ccc; margin-bottom: 10px;" /><br />
<input type="text" name="Betreff" value="subject" tabindex="4" size="20" style="background-color:#eee; border: 1px solid #ccc; margin-bottom: 10px;" /><br />
<textarea name="Text" id="Text" tabindex="5" cols="50" rows="10" style="overflow:auto; font-family:Verdana, Geneva, sans-serif; background-color:#eee; border: 1px solid #ccc; margin: 0;">text...</textarea>
<button type="button" id="Submit" name="Submit" tabindex="6" style="margin-left: 20px; background-color:#eee; border: 1px solid #ccc; padding: 3px 8px;">Submit</button>
</fieldset>

</form>

</div>

</body>
</html>

contact_form.php:
PHP-Code:
<?php
$Empfaenger 
"bastopii@gmail.com";

if (empty(
$_POST['Vorname']) || empty($_POST['Nachname']) || empty($_POST['Email']) ||
    empty(
$_POST['Betreff']) || empty($_POST['Text']))
{
    
$my_msg "Fill up all the fields!";
} else
{
    
$Mailnachricht "Sie haben eine Anfrage über ihr 
        Kontaktformular erhalten:\n\n"
;
    while (list(
$Formularfeld$Wert) = each($_POST))
    {
        if (
$Formularfeld != "Submit")
        {
            
$Mailnachricht .= $Formularfeld ": " $Wert "\n";
        }
    }
    
$Mailnachricht .= "\nDatum/Zeit: ";
    
$Mailnachricht .= date("d.m.Y H:i:s");
    
$Mailbetreff "Contact: ";
    
$Mailbetreff .= $_POST['Betreff'];
    
mail($Empfaenger$Mailbetreff$Mailnachricht"From: " $_POST['Email']);

    
$my_msg "Your message has been sent!";

}

echo 
$my_msg;
?>
büdde dange..

Geändert von bastooo (08-09-2011 um 11:30 Uhr)
bastooo ist offline   Mit Zitat antworten
Alt 08-09-2011, 13:18   #22 (permalink)
Inventar
 
Benutzerbild von Nightflyer
 
Registriert seit: Jul 2002
Beiträge: 6.882
Ja was funktioniert denn nicht? Hast du Firebug? Damit siehst du genau was du abschickst und was wieder zurück ankommt

Code:
$.post( 'contact_form.php', $('#myform').serialize(), function( data ){
//Nicht vergessen hier den Pfad wieder zu ändern!!
$.post( 'form/contact_form.php', $('#myform').serialize(), function( data ){
Bei mir hat es funktioniert
__________________
(\__/)
(='.'=)
(")_(")
Nightflyer ist offline   Mit Zitat antworten
Alt 08-09-2011, 15:02   #23 (permalink)
Neuer User
 
Registriert seit: Jun 2011
Beiträge: 21
Danke, danke danke!!! Endlich funktionierts --> ich hab wieder vergessen den Pfad zu ändern....

DANKEEE!
bastooo ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
kontaktformular, php, text schreiben, textarea, textausgabe echo

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
[Flash CS4] Textausgabe Aerzte1992 Flash Einsteiger 4 25-06-2009 21:22
textausgabe marcworm Flash MX 2 17-07-2004 19:37
Textausgabe Phips ActionScript 1 3 18-03-2004 12:23
textausgabe im99 ActionScript 1 4 01-11-2001 22:05
textausgabe im99 Flash 4 und Flash 5 1 01-11-2001 22:02


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:18 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele