Contact Form 7 Daten übergeben

  • Hallo,

    ich bin da auf der Suche nach einer Lösung vielleicht kann mir einer von euch da helfen.

    Ich möchte gerne auf der Startseite einer Webseite Daten in einen date und einem input field erfassen, unterhalb dieser eingabe Felder soll dann ein Link sein der die Werte in eine zwischen Variable speichert und anschließend ein Formular von contact form 7 öffnet und einen teil dieser Daten dort schon befüllt.

    Vielen Dank schon im voraus für das grübeln

    lg Lukas

    • Anzeige

    Hallo!

    Wenn du gerade an deiner Website arbeitest oder dein aktuelles Hosting überdenkst: Wir betreiben mit NetzLiving eine Hosting-Plattform, die speziell auf Performance, Sicherheit und einfache Verwaltung ausgelegt ist.

    • ✔️ Schnelle Ladezeiten (optimiert für WordPress & Co.)
    • ✔️ Deutsche Server & DSGVO-konform
    • ✔️ Persönlicher Support (kein 0815-Ticket-System)

    Mehr erfahren

  • Hallo Lukas,
    Ich denke da wirst du selber etwas basteln müssen. Die Daten kannst du dafür im URL Parameter oder, noch besser, in einem Cookie speichern.

    LG, pixselig

  • Hallo,

    ich blicke da irgendwie nicht durch, hättest du da ein beispiel wie das funktioniert bzw. eine Seite wo ich mir das anschauen kann.

    lg LUkas

  • Hallo,

    ich blicke da irgendwie nicht durch, hättest du da ein beispiel wie das funktioniert bzw. eine Seite wo ich mir das anschauen kann.

    lg LUkas


    Wenn Du Dir auf http://philippi-Reisen.de einmal eine Veranstaltung/Reise in der Detailansicht anschaust, siehst Du die beiden Buttons für Anfrage und Reservierung.
    Diese Verlinken jeweils auf ein eigenes Formular, welches dann bereits mit den relevanten Daten vorausgefüllt ist (Reiseangebot und -Termin, sowie versteckt, falls vorhanden, die Angebotsnummer).
    Im Quelltext siehst Du, das es sich bei den Buttons eigentlich um Formulare handelt.
    Das Formular wird mit Meta Daten des Beitrags gefüllt.

    Aber wenn ich mich richtig erinnere, gibt es eigentlich eine ganz gute Dokumentation zu dem Plugin.

  • Hallo das ist mein Code im Contact Form 7 Editor

    [COLOR=#ff0000]<p>Ihr Name (Pflichtfeld)<br />[/COLOR]
    [COLOR=#ff0000] [dynamictext* dynamicname "CF7_POST key='yourname'"]</p>[/COLOR]
    [COLOR=#ff0000][/COLOR]
    [COLOR=#ff0000]<p>Ihr Vorname (Pflichtfeld)<br />[/COLOR]
    [COLOR=#ff0000] [dynamictext* vorname]</p>[/COLOR]
    [COLOR=#ff0000][/COLOR]
    [COLOR=#ff0000]<p>Ihre E-Mail-Adresse (Pflichtfeld)<br />[/COLOR]
    [COLOR=#ff0000] [email* your-email] </p>[/COLOR]
    [COLOR=#ff0000][/COLOR]
    [COLOR=#ff0000]<p>Anreise [date anreise id:anreise1 class:anreise] </p>[/COLOR]
    [COLOR=#ff0000]<p>Abreise [date abreise id:2 class:abreise] </p>[/COLOR]
    [COLOR=#ff0000][/COLOR]
    [COLOR=#ff0000]<p><a href="http://www.themepeak.at/lavendel/?page_id=21">ANFRAGEN</a></p>[/COLOR]

    Ich möchte nun die Variable yourname über meinen link übermitteln und anschließend in diesen Formular wieder speichern.

    [COLOR=#ff0000]<table width="100%" border="0" cellspacing="0" cellpadding="0">[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td colspan="2" style="padding-top: 10px;"><h3>An- und Abreise</h3></td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>Anreise</td>[/COLOR]
    [COLOR=#ff0000] <td>[date anreise id:1 class:anreise]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>Abreise</td>[/COLOR]
    [COLOR=#ff0000] <td>[date abreise id:2 class:abreise]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>Alter der Kinder</td>[/COLOR]
    [COLOR=#ff0000] <td>[text alterkinder]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td colspan="2" style="padding-top:10px;"><h3>Ihre persönlichen Daten</h3></td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>Vorname *</td>[/COLOR]
    [COLOR=#ff0000] <td>[dynamictext* vorname "CF7_get_custom_field key='vorname'"]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>Name *</td>[/COLOR]
    [COLOR=#ff0000] <td>[dynamictext dynamicname "CF7_GET key='yourname'"]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td style="padding-top: 10px;">Strasse *</td>[/COLOR]
    [COLOR=#ff0000] <td style="padding-top:15px;">[text* strasse]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>Ort *</td>[/COLOR]
    [COLOR=#ff0000] <td>[text* ort]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>PLZ *</td>[/COLOR]
    [COLOR=#ff0000] <td>[text* plz]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>Land *</td>[/COLOR]
    [COLOR=#ff0000] <td>[text* land]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td style="padding-top: 10px;">Telefon *</td>[/COLOR]
    [COLOR=#ff0000] <td style="padding-top:15px;">[text* telefon]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>Fax</td>[/COLOR]
    [COLOR=#ff0000] <td>[text fax]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>E-Mail *</td>[/COLOR]
    [COLOR=#ff0000] <td>[email* your-email]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td colspan="2" style="padding-top:10px;"><h3>Anzahl der Personen</h3></td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td width="30%">Erwachsene </td>[/COLOR]
    [COLOR=#ff0000] <td width="20%">[text erwachsene]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>Kinder</td>[/COLOR]
    [COLOR=#ff0000] <td>[text Kinder]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>&nbsp;</td>[/COLOR]
    [COLOR=#ff0000] <td>&nbsp;</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td colspan="2" style="padding-top: 15px;"><h3>Zusätzliche Angaben</h3></td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>Zimmerwunsch</td>[/COLOR]
    [COLOR=#ff0000] <td>[text zimmerwunsch]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>Pauschalangebot</td>[/COLOR]
    [COLOR=#ff0000] <td>[text pauschalangebot]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>Betreff</td>[/COLOR]
    [COLOR=#ff0000] <td>[text your-subject]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>Ihre Nachricht</td>[/COLOR]
    [COLOR=#ff0000] <td>[textarea your-message]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td style="padding-top:15px;">Ich möchte</td>[/COLOR]
    [COLOR=#ff0000] <td style="padding-top:15px;">[radio ichmoechte "Anfragen" "Buchen"]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td>&nbsp;</td>[/COLOR]
    [COLOR=#ff0000] <td style="padding-top: 15px;">[submit Senden]</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000] <tr>[/COLOR]
    [COLOR=#ff0000] <td colspan="2" style="padding-top: 15px; text-align:center">Die mit den * markierten Felder sind Pflichtfelder.</td>[/COLOR]
    [COLOR=#ff0000] </tr>[/COLOR]
    [COLOR=#ff0000]</table>[/COLOR]

  • In meinem Fall sind die Reiseangebote eigene Beitragsarten (Custom Post Type) mit einer Vielzahl an benutzerdefinierten Feldern (Custom Fields).
    Deshalb ist das Formular in der Templatedatei für den CPT hinterlegt und wird dynamisch mit den Meta Daten aus den CF gefüllt.

    Wenn ich Dich richtig verstanden habe, willst Du jedoch nur auf der Startseite eine solche Auswahl anbieten. Dann kannst Du das entsprechende Formular sicherlich in der Seite, die Du als Startseite definierst hinterlegen.

    Contact Form 7 habe ich nicht verwendet, da die Formulareingaben ja per POST übergeben werden sollen - CF7 ist gedacht zum Versenden von Nachrichten, ich weiss gar nicht, ob es so etwas überhaupt kann.

    Hier mal der von mir verwendete Formularquellcode -

    Code
    <form action="[URL="http://forum.wpde.org/view-source:http://philippi-reisen.de/anfrage"]http://webseite.tld/anfrage[/URL]" method="POST" id="requestform">
                	<input type="hidden" name="referrerID" value="1234" />
                    <input type="hidden" name="booknr" value="" />
                    <input type="hidden" name="offer" value="Angebotsname" />
                	<input type="submit" class="button medium" style="float:left; margin-right:15px;" value="Anfrage" />
    </form>

    Und die entsprechenden Felder im CF7

    Code
    [dynamichidden buchungsnummer id:buchungsnummer uneditable "CF7_POST key='booknr'" ]
    [dynamictext reiseangebot id:reiseangebot uneditable "CF7_POST key='offer'" ]

    Den Reisetermin habe ich doch nicht übergeben, dafür habe ich eine Erweiterung geschrieben, da dieser etwas komplizierter berechnet werden muss-

    Und so sieht das ganze in der Templatedatei aus (nur der Vollständigkeit halber)

    PHP
    <form action="<?php echo home_url(); ?>/anfrage" method="POST" id="requestform">
                    <input type="hidden" name="referrerID" value="<?php echo $post->ID; ?>" />
                    <input type="hidden" name="booknr" value="<?php echo rwmb_meta('jrny_booknr'); ?>" />
                    <input type="hidden" name="offer" value="<?php the_title(); ?>" />
                    <input type="submit" class="button medium" style="float:left; margin-right:15px;" value="Anfrage" />
                </form>

    Ich hoffe, das hilft Dir jetzt weiter. ;-)

  • Okay, das geht so nicht, da 1. die dynamischen Felder Daten "empfangen" - nicht versenden, und 2. CF7 zum Versenden von E-Mails und nicht zum Absetzen von POST Links gedacht ist.

    Also, das Formular musst Du manuell erstellen und zwar in etwa so:

    Und in Deinem CF7 Kontaktformular fügst Du an der Stelle wo bspw. der Name ausgegeben werden soll das dynamische Feld ein:

    Code
    [dynamictext name id:name uneditable "CF7_POST key='name'" ]

    MEGAWORK EDV & Medien Service :: http://megawork.de

    Einmal editiert, zuletzt von MegaWork (21. Oktober 2014 um 21:00)

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!