1
は、目的は、顧客は、フォームPHPのお問い合わせフォームのw /検証&ペイパル
を埋める持つようになるに提出ヒットメールに
が送信されます、メッセージはその後
リダイレクトを表示しますすべて
を隠されている簡単なPayPal支払いに私はPayPalに開くようにページを取得することはできません
<? php
// configure
$name = $_POST['name'];
$from = 'contact <[email protected]>';
$sendTo = 'NEWCONTACT<[email protected]>';
$subject = 'New contact';
$fields = array('name' => 'Name', 'email' => 'Email', 'residence' => 'Residence', 'qualification' => 'Qualification', 'marital' => 'Marital', 'children' => 'Children', 'income' => 'Income', 'asset' => 'Asset', 'phone' => 'phone', 'nationality' => 'Nationality', 'interested' => 'interested', 'occupation' => 'Occupation', 'soccupation' => 'Spouse Occupation', 'SpouseEducationalQualification' => 'SpouseEducationalQualification', 'history' => 'History', 'source' => 'Source', 'comments' => 'Comments'); // array variable name => Text to appear in the email
$okMessage = 'Contact form successfully submitted. Thank you '.$name.
', I will get back to you soon!';
$errorMessage = 'There was an error while submitting the form. Please try again later';
// let's do the sending
try {
foreach($_POST as $key => $value) {
if (isset($fields[$key])) {
$emailText. = "<pre>".
"$fields[$key]: $value".
"</pre>";
}
}
$headers = array('Content-Type: text/html; charset="UTF-8";',
'From: '.$from,
'Reply-To: '.$from,
'Return-Path: '.$from,
);
mail($sendTo, $subject, $emailText, implode("\n", $headers));
$responseArray = array('type' => 'success', 'message' => $okMessage);
} catch (\Exception $e) {
$responseArray = array('type' => 'danger', 'message' => $errorMessage);
}
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
$encoded = json_encode($responseArray);
header('Content-Type: application/json');
echo $encoded;
} else {
echo $responseArray['message'];
}
$query_data = array(
'amount' => '900',
'business' => '[email protected]',
'cmd' => '_xclick',
'currency_code' => 'USD',
'item_number' => $_POST['item_number'],
'item_name' => $_POST['item_name']
);
// redirect to PayPal
header('Location: https://www.paypal.com/?'.http_build_query($query_data));
<form id="contact-form" method="post" action="contact.php" role="form">
<div class="col-md-6">
<div class="form-group">
<input class="form-control" id="form_name" name="name" type="name" placeholder="Your Full Name" required="required" data-error="Firstname is required.">
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<input class="form-control" id="form_email" name="email" type="email" placeholder="Your email" required="required" data-error="Email is required.">
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<input class="form-control" id="income" type="text" name="income" placeholder="Net Monthly Income">
</div>
</div>
<div class="col-md-12">
<button type="submit" class="btn btn-default more-get" name="buy">Submit</button>
<div class="messages"></div>
</form>
とPHP