Javascript 表格发布,提交至';我什么也不做
我是HTML、PHP、JavaScript以及几乎所有web设计的新手。我只想在继续之前把它说出来。以下是我的情况:我正在帮助一个朋友将他的网站迁移到一个新的注册商和主机提供商。我登录到FTP,复制了public_html的内容,并将其移动到新主机指向该站点的位置的public_html。唯一的问题是他现在的状态已经不起作用了 我正在尝试“修复”当前表单。单击submit按钮不会执行任何操作。很显然,它过去是有用的。我做了大量的阅读和研究,从我所能看出,表单缺少了一些东西,比如说它是一个表单。我不知道此表单是否发布到php或某些javascript,这是forms文件夹中的内容: process.phpJavascript 表格发布,提交至';我什么也不做,javascript,php,html,forms,Javascript,Php,Html,Forms,我是HTML、PHP、JavaScript以及几乎所有web设计的新手。我只想在继续之前把它说出来。以下是我的情况:我正在帮助一个朋友将他的网站迁移到一个新的注册商和主机提供商。我登录到FTP,复制了public_html的内容,并将其移动到新主机指向该站点的位置的public_html。唯一的问题是他现在的状态已经不起作用了 我正在尝试“修复”当前表单。单击submit按钮不会执行任何操作。很显然,它过去是有用的。我做了大量的阅读和研究,从我所能看出,表单缺少了一些东西,比如说它是一个表单。我
<?php
require_once '../phpmailer/PHPMailerAutoload.php';
include_once '../phpmailer/functions.php';
if( ! valid_captcha() ) die('Not valid');
if( form_is_empty($_POST) ) die('All fields required');
$name = $_POST['name'];
$email = $_POST['email'];
$phone = isset($_POST['phone']) ? $_POST['phone'] : 'N/A';
$rooms = isset($_POST['rooms']) ? $_POST['rooms'] : 'N/A';
$sqft = isset($_POST['sqft']) ? $_POST['sqft'] : 'N/A';
$message = $_POST['message'];
$date = date("F j, Y", strtotime('now'));
$html = <<<HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="format-detection" content="telephone=no">
<title>Single Column</title>
<style type="text/css">
.header,
.title,
.subtitle,
.footer-text {
font-family: Helvetica, Arial, sans-serif;
}
.header {
font-size: 24px;
font-weight: bold;
padding-bottom: 12px;
color: #DF4726;
}
.footer-text {
font-size: 12px;
line-height: 16px;
color: #aaaaaa;
}
.footer-text a {
color: #aaaaaa;
}
.container {
width: 600px;
max-width: 600px;
}
.container-padding {
padding-left: 24px;
padding-right: 24px;
}
.content {
padding-top: 12px;
padding-bottom: 12px;
background-color: #ffffff;
}
code {
background-color: #eee;
padding: 0 4px;
font-family: Menlo, Courier, monospace;
font-size: 12px;
}
hr {
border: 0;
border-bottom: 1px solid #cccccc;
}
.hr {
height: 1px;
border-bottom: 1px solid #cccccc;
}
.title {
font-size: 18px;
font-weight: 600;
color: #374550;
margin-bottom: 20px;
}
.subtitle {
font-size: 16px;
font-weight: 600;
color: #2469A0;
}
.subtitle span {
font-weight: 400;
color: #999999;
}
.body-text {
font-family: Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 20px;
text-align: left;
color: #333333;
}
body {
margin: 0;
padding: 0;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
table {
border-spacing: 0;
}
table td {
border-collapse: collapse;
}
.ExternalClass {
width: 100%;
}
.ExternalClass,
.ExternalClass p,
.ExternalClass span,
.ExternalClass font,
.ExternalClass td,
.ExternalClass div {
line-height: 100%;
}
.ReadMsgBody {
width: 100%;
background-color: #ebebeb;
}
table {
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}
img {
-ms-interpolation-mode: bicubic;
}
.yshortcuts a {
border-bottom: none !important;
}
@media screen and (max-width: 599px) {
.force-row,
.container {
width: 100% !important;
max-width: 100% !important;
}
}
@media screen and (max-width: 400px) {
.container-padding {
padding-left: 12px !important;
padding-right: 12px !important;
}
}
.ios-footer a {
color: #aaaaaa !important;
text-decoration: underline;
}
</style>
</head>
<body style="margin:0; padding:0;" bgcolor="#F0F0F0" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0" bgcolor="#F0F0F0">
<tr>
<td align="center" valign="top" bgcolor="#F0F0F0" style="background-color: #F0F0F0;">
<br>
<!-- 600px container (white background) -->
<table border="0" width="600" cellpadding="0" cellspacing="0" class="container">
<tr>
<td class="container-padding content" align="left">
<br>
<div class="title">Quote Request Form from Drterrazzo.com on {$date}</div>
<div class="body-text">
<table>
<tr>
<td><strong>Full Name</strong></td>
<td>:</td>
<td>$name</td>
</tr>
<tr>
<td><strong>Email</strong></td>
<td>:</td>
<td>$email</td>
</tr>
<tr>
<td><strong>Phone</strong></td>
<td>:</td>
<td>$phone</td>
</tr>
<tr>
<td><strong>Rooms</strong></td>
<td>:</td>
<td>$rooms</td>
</tr>
<tr>
<td><strong>Sq. Feet</strong></td>
<td>:</td>
<td>$sqft</td>
</tr>
<tr>
<td><strong>Message</strong></td>
<td>:</td>
<td>$message</td>
</tr>
</table>
</div>
</td>
</tr>
</table><!--/600px container -->
</td>
</tr>
</table><!--/100% background wrapper-->
</body>
</html>
HTML;
$config = getMailConfig();
$sendmail = sendMail($config['to'], $config['from'], $config['replyto'], 'Quote Request Form from Drterrazzo.com', $html);
if ($sendmail) {
$data = array('status' => 'success', 'message' => 'Form submitted. We will contact you as soon as possible.');
echo json_encode($data);
exit;
} else {
$data = array('status' => 'error', 'message' => 'Error submitting form. Please contact us via phone. Thank you.');
echo json_encode($data);
exit;
}
A表单
需要具有POST
值的方法
属性作为POST
处理<代码>表单
s还需要一个操作
;该操作是表单提交到的位置
您的表单还需要一个输入
,类型为提交
,图像
,或者需要一些JavaScript函数来提交它
因此,您的表单
元素应该是:
<form class="form mt10" method="post" action="process.php">
<input type="submit" class="btn re-quote fr" >
要将该按钮作为图像,可以使用image
类型。您可以阅读更多关于此的内容:
我建议看一些关于表单处理的教程:
<div class="quote">
<h1>Quote Request </h1>
<form class="form mt10" method"post" action="process.php"><span style="display:none;">Do not enter anything into this field for proper for submission...<input type="text" name="field" /></span>
<div class="field">
<input type="text" class="tinput" placeholder="Name (Required)" name="name" onclick="clearText(this)" onblur="clearText(this)"/>
<input type="text" class="tinput" placeholder="Email (Required)" name="email" onclick="clearText(this)" onblur="clearText(this)"/>
<input type="text" class="tinput" placeholder="Phone" name="phone" onclick="clearText(this)" onblur="clearText(this)"/>
<input type="text" class="tinput" placeholder="No. of Rooms" name="rooms" onclick="clearText(this)" onblur="clearText(this)"/>
<input type="text" class="tinput" placeholder="Approx Sq. ft." name="sqft" onclick="clearText(this)" onblur="clearText(this)"/>
<textarea class="traea" onclick="clearText(this)" onblur="clearText(this)" placeholder="Message" name="message"></textarea>
<input type="submit" class="btn re-quote fr" >
</div>
</form>
</div>
</div>
</div>
<form class="form mt10" method="post" action="process.php">
<input type="submit" class="btn re-quote fr" >
<input type="image" src="image.png">