此表单位于wordpress页面,操作将转到WHMCS Web应用程序中的lead_gen.php。
一切正常,但不是重定向脚本,任何人都可以帮我解决这个问题吗?
我不是脚本专家,所以我有点困惑,我尝试了w3c的示例表单,重定向及其功能。
<script language="javascript">
function checkforms() {
var flag = '';
var email = document.getElementById('email');
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(email.value)) {
flag = flag + 'Please provide a valid email address\n';
}
if (document.getElementById('firstname').value=='') {
flag = flag + 'Please enter the first name\n';
}
if (document.getElementById('lastname').value=='') {
flag = flag + 'Please enter the last name\n';
}
if (document.getElementById('company').value=='') {
flag = flag + 'Please enter the company name';
}
if(flag == '')
return true;
else {
alert(flag);
return false;
}
window.location.assign("http://appterra.com/thankyou/")
}
<form id="leadform" action="https://appterra.net/modules/addons/crmaddon/lead_gen.php" method="post" name="leadform">
<h2>Let's talk ! Tell us a little about yourself.</h2>
<div style="width:380px;float:left;margin-bottom:20px;">
First Name <span style="color: #ff0000">*</span>
<input id="firstname" type="text" name="firstname" size="30" value="" />
Last Name <span style="color: #ff0000">*</span>
<input id="lastname" type="text" name="lastname" size="30" value="" />
Email <span style="color: #ff0000">*</span>
<input id="email" type="text" name="email" size="30" value="" />
Phone
<input type="text" name="phone" size="30" value="" />
</div>
<div style="width:380px;float:left;margin-bottom:170px;">
Company <span style="color: #ff0000">*</span>
<input id="company" type="text" name="company" size="30" value="" />
Country
<input type="text" name="country" size="30" value="" />
</div>
How can we help ?</label></td>
<textarea cols="29" name="description" rows="2" style="width:400px;height:200px;"> </textarea>
Your privacy is important to us. We will never sell your name or constantly hassle you.
<input id="button" type="submit" onclick="checkforms()" value="Submit" style="background: #333; padding: 10px; color:#fff; border-radius: 5px 5px; -webkit-border-radius: 5px 5px; -moz-border-radius: 5px 5px; font-size:16px;cursor:pointer;margin:40px 120px 0 0;float:right;"/>
<input type="hidden" name="lead_save" value="lead_save" />
</form>
我错过了什么吗?请帮忙