<?php
// Emails form data to you and the person submitting the form and adds it to a database
// Test for db
$db = new mysqli("DB_HOST","DB_USER","DB_PASSWORD","DB_NAME");
$sql = "SELECT id FROM form_submissions";
$result = $db->query($sql);
if (empty($result)) {
$sql = "CREATE TABLE `form_submissions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` text COLLATE utf8_unicode_ci,
`phone` text COLLATE utf8_unicode_ci,
`email` int(11) DEFAULT NULL,
`message` text COLLATE utf8_unicode_ci,
`submitted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
$result = $db->query($sql);
}
// Set your email below
$myemail = "ENTER_YOUR_EMAIL_HERE"; // Replace with your email
// Receive and sanitize input
$name = mysqli_real_escape_string($db, $_POST['name']);
$email = mysqli_real_escape_string($db, $_POST['email']);
$phone = mysqli_real_escape_string($db, $_POST['phone']);
$message = mysqli_real_escape_string($db, $_POST['message']);
// write to db
$sql = "INSERT INTO form_submissions (name,phone,email,message) VALUES ('$name','$phone','$email','$message')";
$result = $db->query($sql);
// set up email
$msg = "New contact form submission!\nName: " . $name . "\nEmail: " . $email . "\nPhone: " . $phone . "\nEmail: " . $email;
$msg = wordwrap($msg,70);
mail($myemail,"New Form Submission",$msg);
mail($email,"Thank you for your form submission",$msg);
echo 'Thank you for your submission. Please <a href="index.html">Click here to return to our homepage.';
?>
没有合适的资源?快使用搜索试试~ 我知道了~
咖啡coffee休闲食品企业网站模板_咖啡 coffee 休闲 食品 企业 bootstrap 下午茶 简单_html.rar
共22个文件
jpg:5个
html:4个
js:3个
0 下载量 86 浏览量
2023-08-06
11:49:12
上传
评论
收藏 487KB RAR 举报
温馨提示
咖啡coffee休闲食品企业网站模板_咖啡 coffee 休闲 食品 企业 bootstrap 下午茶 简单_html.rar
资源推荐
资源详情
资源评论
收起资源包目录
咖啡coffee休闲食品企业网站模板_咖啡 coffee 休闲 食品 企业 bootstrap 下午茶 简单_html.rar (22个子文件)
咖啡coffee休闲食品企业网站模板_咖啡 coffee 休闲 食品 企业 bootstrap 下午茶 简单
btts_56_casual-gh-pages
form-handler.php 2KB
js
bootstrap.js 70KB
bootstrap.min.js 36KB
jquery.js 94KB
form-handler-nodb.php 714B
img
intro-pic.jpg 6KB
slide-3.jpg 27KB
slide-1.jpg 13KB
bg.jpg 192KB
slide-2.jpg 36KB
css
bootstrap.min.css 118KB
business-casual.css 4KB
bootstrap.css 149KB
index.html 9KB
contact.html 7KB
about.html 6KB
blog.html 6KB
fonts
glyphicons-halflings-regular.svg 106KB
glyphicons-halflings-regular.ttf 44KB
glyphicons-halflings-regular.woff 23KB
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regular.woff2 18KB
共 22 条
- 1
资源评论
dunming_6725413
- 粉丝: 16
- 资源: 6950
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功