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;
?>