Visualizzazione dei risultati da 1 a 9 su 9
  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2008
    Messaggi
    7

    Form Mail - invio e visualizzazione

    Ciao a tutti,
    avrei un problema con un form email. Praticamente vorrei che l'utente una volta compilato ed inviato il form via email venisse reindirizzato su un'altra pagina con il riassunto delle informazioni inserite nel form. Ho provato in mille modi, ma l'unica cosa che ottengo e' o la visualizzazione dei dati o l'invio della mail. E' come se una volta effettuato l'invio la variabile $POST non sia piu utilizzabile.
    Spero che qualcuno abbia la pazienza di aiutarmi.

    Grazie

  2. #2
    Moderatore di PHP L'avatar di Alhazred
    Registrato dal
    Oct 2003
    Messaggi
    12,505
    Posta il codice.

  3. #3
    Utente di HTML.it
    Registrato dal
    Jul 2008
    Messaggi
    7
    Ok. ho un primo file con il form:

    Voucher.html

    <form action="voucher.php" method="post" name="form1" target="_blank" id="form1">
    <p class="data">your details:</p>
    <div id="databox">
    <label for="yourname">name</label>

    <input type="text" size="40" name="yourname" id="yourname" accesskey="n" tabindex="1">

    <label for="yourmobile">mobile</label>

    <input name="yourmobile" type="tel" size="40" id="yourmobile" accesskey="m" tabindex="2">

    <label for="youremail">email</label>

    <input name="youremail" type="email"
    size="40" id="youremail" accesskey="e" tabindex="3">
    </div>
    <div id="voucher">
    <table cellspacing="0" cellpadding="0">
    <tr>
    <td width="308" class="data">the voucher</td>
    <td width="286" align="center" bgcolor="#CCCCCC">help with this section please</td>
    </tr>
    </table></div>
    <div id="databox">
    <table width="480" border="0" cellpadding="0" cellspacing="0" >
    <tr>
    <td width="174"> <label for="howlong">what's it for?</label></td>
    <td width="94" align="right">...or</td>
    <td width="26"></td>
    <td width="186">what's it worth?</td>
    </tr>
    <tr>
    <td colspan="2"><select name="howlong" size="1" style="height:36px; width:280px" id="howlong" accesskey="h" tabindex="6">
    <option value="value">I'll set a dollar value</option>
    <option value="30">30min massage session</option>
    <option value="45">45min massage session</option>
    <option value="60" selected="selected">60min massage session</option>
    <option value="75">75min massage session</option>
    <option value="90">90min massage session</option>
    </select></td>
    <td></td>
    <td><input type="text" name="howmuch" id="howmuch" value="$" size="14" accesskey="h" tabindex="7"></td>
    </tr>
    <tr>
    <td colspan="2">what kind of treatment?</td>
    <td></td>
    <td>see the rate card</td>
    </tr>
    <tr>
    <td colspan="2"> <select name="whatkind" size="1" id="whatkind" style="height:36px; width:280px" tabindex="8">
    <option value="remedial">remedial </option>
    <option value="pregnancy">pregnancy massage</option> <option value="relax">relaxation</option>
    <option value="deep">deep tissue</option>
    <option value="sports">sports</option>
    <option value="hot">hot stone</option>
    <option value="reflex">reflexology</option>
    <option value="lymph">lymphatic drainage</option> <option value="myo">myofascial release</option>
    <option value="aroma">aromatherapy</option>

    <option value="msg+facial">massage + facial</option>
    <option value="indian">indian head</option>
    <option value="reiki">reiki</option>
    <option value="hydra">hydration facial</option>
    <option value="seasalt">sea salt body scrub</option>
    <option value="blank" selected="selected">my friend will decide</option>
    </select></td>
    <td></td>
    <td class="greenbold" align="center" valign="middle" bgcolor="#FFFFFF">ratecard</td>
    </tr>
    </table> <label for="recipient">who gets your voucher?</label>

    <input type="text" size="40" name="recipient" id="recipient" accesskey="w" tabindex="4">

    <label for="donor">who gives this voucher?</label>

    <input name="donor" type="text" size="40" id="donor" accesskey="g" tabindex="5"></div>

    <p class="data">the delivery:</p>
    <div id="databox" class="lighter">
    <table width="480" border="0" cellpadding="0" cellspacing="0" id="comments">
    <tr>
    <td width="300"><label>
    <input name="send" type="radio" id="send_0" value="post2me" checked="checked" tabindex="8" >
    send it to my address</label>


    <label>
    <input type="radio" name="send" value="post2friend" id="send_1" />
    sent it to my friend's address</label>


    <label>
    <input type="radio" name="send" value="email2me" id="send_2" />
    send it by email to me</label>

    <label>
    <input type="radio" name="send" value="email2friend" id="send_3" />
    send it to my friend's email</label>

    <label>
    <input name="send" type="radio" id="send_4" value="collect" />
    I'll collect it</label></td>
    <td><label for="details">Address or email<textarea name="details" cols="24" rows="8"></textarea></label></td>
    </tr></table>
    </div>
    <hr />
    <span class="italicson12">A gift voucher is nominative, not refundable nor can it be redeemed for cash.</span>
    <hr />
    <p class="twenty4points">if you're ready to pay, please click <input name="submit" type="submit" id="submit" tabindex="9" value="continue" />
    </p>
    </form>



    un secondo file con il codice che mi invia l'email e mi reinderizza a una terza pagina dove vorrei che venissero visualizzati i dati del form che la persona ha compilato:

    voucher.php

    <?php

    // ------------- CONFIGURABLE SECTION ------------------------

    $mailto = 'mioindirizzo@mail.com' ;


    // $subject - set to the Subject line of the email, eg
    //$subject = "Feedback Form" ;

    $subject = "gift voucher" ;

    $formurl = "voucher.html" ;
    $errorurl = "vouchererror.html" ;
    $thankyouurl = "voucher3.html" ;

    $yourname_is_required = 1;
    $youremail_is_required = 0;
    $yourmobile_is_required = 1;
    $howlong_is_required = 1;
    $howmuch_is_required = 0;
    $whatkind_is_required = 1;
    $recipient_is_required = 1;
    $donor_is_required = 1;
    $send_is_required = 1;
    $details_is_required = 0;
    $uself = 0;
    $use_envsender = 0;
    $use_sendmailfrom = 0;
    $use_webmaster_email_for_from = 0;
    $use_utf8 = 1;
    $my_recaptcha_private_key = '' ;

    // -------------------- END OF CONFIGURABLE SECTION ---------------

    $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
    $content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ;
    if (!isset( $use_envsender )) { $use_envsender = 0 ; }
    if (isset( $use_sendmailfrom ) && $use_sendmailfrom) {
    ini_set( 'sendmail_from', $mailto );
    }
    $envsender = "-f$mailto" ;
    $yourname = (isset($_POST['yourname']))? $_POST['yourname'] : $_POST['yourname'] ;
    $youremail = $_POST['youremail'] ;
    $yourmobile = $_POST['yourmobile'] ;
    $howlong = $_POST['howlong'] ;
    $howmuch = $_POST['howmuch'] ;
    $whatkind = $_POST['whatkind'] ;
    $recipient = $_POST['recipient'] ;
    $donor = $_POST['donor'] ;
    $send = $_POST['send'] ;
    $details = $_POST['details'] ;
    $http_referrer = getenv( "HTTP_REFERER" );


    if (!isset($_POST['youremail'])) {
    header( "Location: $formurl" );
    exit ;
    }
    if (($youremail_is_required && (empty($youremail) || !preg_match('/@/', $youremail))) || ($yourname_is_required && empty($yourname)) || ($yourmobile_is_required && empty($yourmobile)) || ($howlong_is_required && empty($howlong)) || ($howmuch_is_required && empty($howmuch)) || ($whatkind_is_required && empty($whatkind)) || ($recipient_is_required && empty($recipient)) || ($donor_is_required && empty($donor)) || ($send_is_required && empty($send)) || ($details_is_required && empty($details)) || ($howmuch_is_required && empty($howmuch))) {
    header( "Location: $errorurl" );
    exit ;
    }
    if ( preg_match( "/[\r\n]/", $yourname ) || preg_match( "/[\r\n]/", $youremail ) ) {
    header( "Location: $errorurl" );
    exit ;
    }
    if (strlen( $my_recaptcha_private_key )) {
    require_once( '../../testing/edge/recaptchalib.php' );
    $resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
    if (!$resp->is_valid) {
    header( "Location: $errorurl" );
    exit ;
    }
    }
    if (empty($youremail)) {
    $youremail = $mailto ;
    }
    $fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ;

    if (function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc()) {
    $details = stripslashes( $details );
    }

    //$messageproper =
    // "This message was sent from:\n" .
    // "$http_referrer\n" .

    $messageproper = "This message was sent from miosito\n\n" .



    "-------------------THE SENDER-----------------------\n\n" .

    "name of sender: $yourname\n" .
    "email of sender: $youremail\n" .
    "mobile of sender: $yourmobile\n\n" .

    "-----------------WHAT, WHO, HOW--------------------\n\n" .

    "how long the massage: $howlong\n" .
    "how much the GV: $howmuch\n" .
    "what kind of massage: $whatkind\n" .
    "who gets the GV: $recipient\n" .
    "who gives the GV: $donor\n" .
    "how do we send the GV: $send\n\n" .

    "------------------ DETAILS ------------------\n\n" .
    $details .

    "\n\n----------------------------------------------\n" ;

    $headers =
    "From: \"$yourname\" <$youremail>" . $headersep . "Reply-To: \"$yourname\" <$youremail>" . $headersep . "X-Mailer: chfeedback.php 2.15.0" .
    $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ;

    if ($use_envsender) {
    mail($mailto, $subject, $messageproper, $headers, $envsender );
    }
    else {
    mail($mailto, $subject, $messageproper, $headers );
    }
    header( "Location: $thankyouurl" );
    exit ;

    ?>


    Il problema e' che se inserisco il seguente codice nella terza pagina php il codice non mi restituisce i dati:

    <?php
    echo " I dati inseriti sono
    Your name: ".$yourname."
    Your mobile: ".$yourmobile."
    Your email: ".$youremail;
    ?>

  4. #4
    Utente di HTML.it L'avatar di las
    Registrato dal
    Apr 2002
    Messaggi
    1,221
    tu hai 3 pagine, la pagina del form, la pagina di invio email e la pagina di riepilogo, quando l'utente compila il form invia i dati in post alla pagina di invio email e qui puoi usare $_POST, ma puoi usarla solo qui, quando ti sposti nella pagina di riepilogo non hai più la variabile $_POST, la soluzione più facile è quella di dare il riepilogo direttamente nella seconda pagina, altrimenti per inviare i dati alla terza pagina devi per forza usare le sessioni.

    Il calcolatore è straordinariamente veloce, accurato e stupido.
    L'uomo è incredibilmente lento, impreciso e creativo.
    L'insieme dei due costituisce una forza incalcolabile.
    (Albert Einstein)

  5. #5
    Utente di HTML.it
    Registrato dal
    Jul 2008
    Messaggi
    7
    Ciao Las,
    ho provato a fare come dici tu ma il problema e' che se inserisco l'echo nella seconda pagina ottengo i dati a video ma anche un errore sull'invio degli headers che non riesco a risolvere.
    Tu hai qualche idea in proposito? Sono giorni che sono bloccato a questo punto.
    Grazie

  6. #6
    Utente di HTML.it L'avatar di las
    Registrato dal
    Apr 2002
    Messaggi
    1,221
    ovviamente se metti gli echo nella seconda pagina devi togliere qualsiasi reindirizzamento alla terza pagina, tipo questo:

    header( "Location: $thankyouurl" );
    Il calcolatore è straordinariamente veloce, accurato e stupido.
    L'uomo è incredibilmente lento, impreciso e creativo.
    L'insieme dei due costituisce una forza incalcolabile.
    (Albert Einstein)

  7. #7
    Utente di HTML.it
    Registrato dal
    Jul 2008
    Messaggi
    7
    Ok pero' non riesco ad ottenere il risultato sperato.
    Potresti essere cosi gentile, se possibile, di darmi una soluzione funzionante. Mi si sta fondendo il cervello. Mi sembra di non trovare una via d'uscita
    Grazie

  8. #8
    Utente di HTML.it
    Registrato dal
    Jul 2008
    Messaggi
    7
    Ciao Las,
    grazie al tuo consiglio ho risolto il problema.
    Ora pero' ne ho di fronte un altro, nella pagina voucher.php ho aggiunto del codice html all'inizio e fin qui tutto bene ma quando aggiungo il pulsante di pagamento di paypal questo non viene visualizzato. In pratica si vede l'intestazione in html l'echo del form ma non il pulsante paypal. Potresti darmi un'ultimo aiutino per concludere il tutto?
    Ti ringrazio

    <html>
    <head>
    <meta charset="utf-8">
    <title>gift voucher</title>
    <link href="../css/index_mq.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <div id="topbar" class="blacker">gift voucher</div>

    <div id="v3message">Mio testo


    Please verify your data: </p></div>


    <?php

    // ------------- CONFIGURABLE SECTION ------------------------

    $mailto = 'mioindirizzo@mail.com' ;


    // $subject - set to the Subject line of the email, eg
    //$subject = "Feedback Form" ;

    $subject = "gift voucher" ;

    //$formurl = "voucher.html" ;
    //$errorurl = "vouchererror.html" ;
    //$thankyouurl = "voucher3.php" ;

    $yourname_is_required = 1;
    $youremail_is_required = 0;
    $yourmobile_is_required = 1;
    $howlong_is_required = 1;
    $howmuch_is_required = 0;
    $whatkind_is_required = 1;
    $recipient_is_required = 1;
    $donor_is_required = 1;
    $send_is_required = 1;
    $details_is_required = 0;
    $uself = 0;
    $use_envsender = 0;
    $use_sendmailfrom = 0;
    $use_webmaster_email_for_from = 0;
    $use_utf8 = 1;
    $my_recaptcha_private_key = '' ;

    // -------------------- END OF CONFIGURABLE SECTION ---------------

    $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
    $content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ;
    if (!isset( $use_envsender )) { $use_envsender = 0 ; }
    if (isset( $use_sendmailfrom ) && $use_sendmailfrom) {
    ini_set( 'sendmail_from', $mailto );
    }
    $envsender = "-f$mailto" ;
    $yourname = (isset($_POST['yourname']))? $_POST['yourname'] : $_POST['yourname'] ;
    $youremail = $_POST['youremail'] ;
    $yourmobile = $_POST['yourmobile'] ;
    $howlong = $_POST['howlong'] ;
    $howmuch = $_POST['howmuch'] ;
    $whatkind = $_POST['whatkind'] ;
    $recipient = $_POST['recipient'] ;
    $donor = $_POST['donor'] ;
    $send = $_POST['send'] ;
    $details = $_POST['details'] ;
    $http_referrer = getenv( "HTTP_REFERER" );


    //if (!isset($_POST['youremail'])) {
    // header( "Location: $formurl" );
    // exit ;
    //}

    if (($youremail_is_required && (empty($youremail) || !preg_match('/@/', $youremail))) || ($yourname_is_required && empty($yourname)) || ($yourmobile_is_required && empty($yourmobile)) || ($howlong_is_required && empty($howlong)) || ($howmuch_is_required && empty($howmuch)) || ($whatkind_is_required && empty($whatkind)) || ($recipient_is_required && empty($recipient)) || ($donor_is_required && empty($donor)) || ($send_is_required && empty($send)) || ($details_is_required && empty($details)) || ($howmuch_is_required && empty($howmuch))) {
    header( "Location: $errorurl" );
    exit ;
    }
    if ( preg_match( "/[\r\n]/", $yourname ) || preg_match( "/[\r\n]/", $youremail ) ) // {
    //header( "Location: $errorurl" );
    //exit ;
    //}
    //if ( preg_match( "/[\r\n]/", $yourname ) || preg_match( "/[\r\n]/", $youremail ) ) {
    // header( "Location: $errorurl" );
    // exit ;
    //}
    //if (strlen( $my_recaptcha_private_key )) {
    // require_once( '../../testing/edge/recaptchalib.php' );
    // $resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
    // if (!$resp->is_valid) {
    // header( "Location: $errorurl" );
    // exit ;
    // }
    //}
    if (empty($youremail)) {
    $youremail = $mailto ;
    }
    $fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ;

    if (function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc()) {
    $details = stripslashes( $details );
    }

    //$messageproper =
    // "This message was sent from:\n" .
    // "$http_referrer\n" .

    $messageproper = "This message was sent from miosito\n\n" .



    "-------------------THE SENDER-----------------------\n\n" .

    "name of sender: $yourname\n" .
    "email of sender: $youremail\n" .
    "mobile of sender: $yourmobile\n\n" .

    "-----------------WHAT, WHO, HOW--------------------\n\n" .

    "how long the massage: $howlong\n" .
    "how much the GV: $howmuch\n" .
    "what kind of massage: $whatkind\n" .
    "who gets the GV: $recipient\n" .
    "who gives the GV: $donor\n" .
    "how do we send the GV: $send\n\n" .

    "------------------ DETAILS ------------------\n\n" .
    $details .

    "\n\n----------------------------------------------\n" ;

    //$headers =
    // "From: \"$yourname\" <$youremail>" . $headersep . "Reply-To: \"$yourname\" //<$youremail>" . $headersep . "X-Mailer: chfeedback.php 2.15.0" .
    // $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ;

    if ($use_envsender) {
    mail($mailto, $subject, $messageproper, $headers, $envsender );
    }
    else {
    mail($mailto, $subject, $messageproper, $headers );
    }
    //header( "Location: $thankyouurl" );
    exit ;

    ?>

    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="hosted_button_id" value="">
    <table>
    <tr><td><input type="hidden" name="on0" value="Select payment:">Select payment:</td></tr><tr><td><select name="os0">
    <option value="standard 30' treatment.....$50.00 AUD">standard 30' treatment.....$50.00 AUD</option>
    <option value="premium 30' treatment.....$55.00 AUD">premium 30' treatment.....$55.00 AUD</option>
    <option value="standard 45' treatment.....$70.00 AUD">standard 45' treatment.....$70.00 AUD</option>
    <option value="premium 45' treatment....$75.00 AUD">premium 45' treatment....$75.00 AUD</option>
    <option value="standard 60' treatment.....$85.00 AUD">standard 60' treatment.....$85.00 AUD</option>
    <option value="premium 60' treatment....$90.00 AUD">premium 60' treatment....$90.00 AUD</option>
    <option value="standard 75' treatment...$100.00 AUD">standard 75' treatment...$100.00 AUD</option>
    <option value="premium 75' treatment...$105.00 AUD">premium 75' treatment...$105.00 AUD</option>
    <option value="standard 90' treatment...$120.00 AUD">standard 90' treatment...$120.00 AUD</option>
    <option value="premium 90' treatment...$125.00 AUD">premium 90' treatment...$125.00 AUD</option>
    </select> </td></tr>
    <tr><td><input type="hidden" name="on1" value="Your comments or instructions">Your comments or instructions</td></tr><tr><td><input type="text" name="os1" maxlength="200"></td></tr>
    </table>
    <input type="hidden" name="currency_code" value="AUD">
    <input type="image" src="http://miosito.com/images/paypal.gif" border="0" name="submit" alt="PayPal — The safer, easier way to pay online.">

    </form>
    </body>
    </html>

  9. #9
    Utente di HTML.it
    Registrato dal
    Jul 2008
    Messaggi
    7
    C'e' qualcono che puo' aiutarmi per favore? Sono in un vicolo cieco
    Grazie

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.