生成一个穿越火线活动抽奖页面
时间: 2023-11-22 10:56:45 浏览: 50
好的,我可以为您生成一个穿越火线活动抽奖页面,以下是一个简单的示例:
HTML代码:
```
<!DOCTYPE html>
<html>
<head>
<title>穿越火线活动抽奖页面</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}
h1 {
text-align: center;
color: #444;
}
form {
width: 80%;
margin: 0 auto;
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
label {
display: block;
margin-bottom: 10px;
color: #666;
}
input[type="text"],
input[type="email"] {
display: block;
width: 100%;
padding: 10px;
border-radius: 3px;
border: 1px solid #ccc;
margin-bottom: 20px;
}
input[type="submit"] {
background-color: #ff6600;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 3px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #e55b00;
}
.error {
color: red;
margin-bottom: 10px;
}
.success {
color: green;
margin-bottom: 10px;
}
</style>
</head>
<body>
<h1>穿越火线活动抽奖</h1>
<form method="post" action="process.php">
<label for="name">姓名:</label>
<input type="text" name="name" id="name" required>
<label for="email">邮箱:</label>
<input type="email" name="email" id="email" required>
<input type="submit" value="参加抽奖">
</form>
</body>
</html>
```
PHP代码(process.php):
```
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$to = 'youremail@example.com';
$subject = '穿越火线活动抽奖参与者';
$message = "姓名:$name\n";
$message .= "邮箱:$email\n";
$headers = 'From: yourname@example.com' . "\r\n" .
'Reply-To: yourname@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
if (mail($to, $subject, $message, $headers)) {
echo '<p class="success">您已成功参与抽奖!</p>';
} else {
echo '<p class="error">邮件发送失败,请联系管理员。</p>';
}
?>
```
这是一个简单的抽奖页面,用户填写姓名和邮箱后,点击“参加抽奖”按钮,将会向您的邮箱发送一封邮件,告知用户已参与抽奖。您需要将 `$to` 变量修改为您的邮箱地址,以便接收邮件。同时,您还需要将 `yourname@example.com` 修改为您的实际发件人邮箱。