Why does the form not show a success outcome
this temporary page - get started. enquire here loanfinder business loans.
when data entered correctly form, throwing code error instead of success outcome should re-direct page (article description ) , send email coded.
i ran page through error checker - showing results http://www.loanfinder.com.au/formtest2.php - nu html checker , cannot understand results.
the current code :
<?php
require_once "includes/phpmailerautoload.php";
function sanitisedpost($namedindex) {
if (!isset($_post[$namedindex])) {
// post field not set
return null;
}
return htmlentities($_post[$namedindex]);
}
if (isset($_post["submit"])) {
// lets handle of form processing if form has been submitted
$name = sanitisedpost('name');
$email = $_post['email'];
$phone = sanitisedpost('phone');
$businessname = sanitisedpost('businessname');
$state = sanitisedpost('state');
$timeinbusiness = sanitisedpost('timeinbusiness');
$loansize = sanitisedpost('loansize');
$privacycheck = sanitisedpost('privacycheck');
//valid address on web server
$from = 'loan@loanfinder.com.au';
//your email address wish receive mail
$to = 'loan@loanfinder.com.au';
$subject = 'loan enquiry';
$body = "from: $name\n
e-mail: $email\n
phone: $phone\n
business name: $businessname\n
state: $state\n
time in business: $timeinbusiness\n
loan size: $loansize\n
privacy check: $privacycheck\n";
$errors = array();
if ($name == null || strlen($name)==0) {
$errors[] = "please enter name";
}
if ($timeinbusiness==null) {
$errors[] = "time in business not set";
}
if ($privacycheck==null) {
$errors[] = "privacy check not set";
}
if ($email == null || strlen($email)==0) {
$errors[] = "please enter email address";
} else {
if (!filter_var($email,filter_validate_email)) {
$errors[] = "please enter valid email address";
}
}
// check if phone entered
if ($phone == null || strlen($phone)<10) {
$errors[] = "please enter phone number";
}
// if there no errors, send email & output results form
if (!count($errors)) {
$mail = new phpmailer();
$mail->issmtp();
$mail->host = "launch.server101.com";
$mail->port = 25;
$mail->smtpdebug = 1;
$mail->setfrom($from,"form submission");
$mail->addaddress($to, $name);
$mail->subject = $subject;
//$mail->msghtml($body);
$mail->altbody = $body;
if ($mail->send()) {
$result = '<div class="alert alert-success"><h2><span class="glyphicon glyphicon-ok"></span> message sent!</h2><h3>thank contacting us. in touch soon.</h3></div>';
// if wish redirect page:
header("location: http://www.loanfinder.com.au/thankyou.html");
} else {
$result = '<div class="alert alert-danger"><h2><span class="glyphicon glyphicon-warning-sign"></span> sorry there form processing error.</h2> <h3>please try again later.</h3></div>';
}
} else {
$errors = implode(", ",$errors);
$result = '<div class="alert alert-danger"><h2><span class="glyphicon glyphicon-warning-sign"></span> sorry there form processing error. errors returned were: '.$errors.'</h2> <h3>please try again later.</h3></div>';
}
echo $result;
return;
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>get started. enquire here loanfinder business loans.</title>
<meta name="description" content="get started here. loanfinder business loans. loans approved , funded business based on cashflow.">
<meta name="robots" content="index,follow">
<!-- bootstrap -->
<link href="css/bootstrap.css" rel="stylesheet">
<link href="styles.css" rel="stylesheet" type="text/css">
<!-- html5 shim , respond.js ie8 support of html5 elements , media queries -->
<!-- warning: respond.js doesn't work if view page via file:// -->
<!--[if lt ie 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container-fluid" id="wrapper">
<!--top nav-->
<nav class="navbar navbar-default navbar-fixed-top" id="navbar" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<a href="index.html"><img src="images/logo2.jpg" width="185" height="51" alt=""/></a>
</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#mynavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse navprop" id="mynavbar">
<ul class="nav navbar-nav navbar-right">
<li><a href="resources.html">1800 090 555 </a></li>
<li><a href="index.html">home</a></li>
<li><a href="how works.html">how works</a></li>
<li><a href="questions.html">questions</a></li>
<li><a href="resources.html">resources</a></li>
</ul>
</div>
</div>
</nav>
<!--end top nav-->
<div class="container">
<p></p>
<p></p>
<p></p>
<h1 class="text-center"><strong>get started</strong></h1>
<p></p>
<h5>how apply?</h5>
<p>complete quick form below , loan consultant contact discuss requirements.</p>
<p>our privacy policy can found <a href="privacy policy.html">here</a></p>
<p></p>
<style>
.required {
color: red;
font-weight: bold
}
.center-block {
float: none
}
.human {
margin: 0 0 0 12px
}
</style>
<div class="container-fluid">
<div class="col-md-8 center-block">
<h3>the smart way finance business</h3>
<p class="required small">grow business , manage cash flow unsecured business loan. </p>
<p> </p>
<p> </p>
<!--begin html form-->
<form class="form-horizontal" method="post" action="">
<div class="form-group">
<label for="name" class="col-sm-3 control-label"><span class="required">*</span> first name:</label>
<div class="col-sm-5">
<input type="text" class="form-control" id="name" name="name" placeholder="first name">
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-3 control-label"><span class="required">*</span> email: </label>
<div class="col-sm-5">
<input type="email" class="form-control" id="email" name="email" placeholder="you@domain.com">
</div>
</div>
<div class="form-group">
<label for="phone" class="col-sm-3 control-label"><span class="required">*</span> phone number: </label>
<div class="col-sm-5">
<input type="tel" class="form-control" id="phone" name="phone" placeholder="0400 000 000 or 02 1234 5678">
</div>
</div>
<div class="form-group">
<label for="business name" class="col-sm-3 control-label"> business trading name</label>
<div class="col-sm-7">
<input class="form-control" row="4" name="businessname" placeholder="business / company name">
</div>
</div>
<div class="form-group">
<label for="state" class="col-sm-3 control-label"> select state</label>
<div class="col-sm-9">
<select name="state" class="col-sm-3 control-label">
<option value="">select</option>
<option value="nsw">nsw</option>
<option value="qld">qld</option>
<option value="vic">vic</option>
<option value="wa">wa</option>
<option value="sa">sa</option>
<option value="nt">nt</option>
<option value="act">act</option>
<option value="other">other</option>
</select>
</div>
</div>
<p> </p>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6 col-sm-offset-3">
<p class="required">time in business
</p>
<p>
<label>
<input type="radio" name="timeinbusiness" value="radio" id="lessthan6months">
less 6 months</label>
<br>
<label>
<input type="radio" name="timeinbusiness" value="radio" id="6to12months">
6 12 months</label>
<br>
<label>
<input type="radio" name="timeinbusiness" value="radio" id="over1year">
on 1 year</label>
<br>
</p>
<p class="required">loan amount required
</p>
<p>
<label>
<input type="radio" name="loansize" value="radio" id="upto$50k">
$5k $50k</label>
<br>
<label>
<input type="radio" name="loansize" value="radio" id="upto$250k">
$50k $250k</label>
<br>
<label>
<input type="radio" name="loansize" value="radio" id="over$250k">
on $250k</label>
<br>
</p>
<p> </p>
<div class="form-group">
<p>
<label>
<input type="checkbox" required name="privacycheck" value="checkbox" id="privacycheck">
have reviewed, understand , consent privacy policy</label>
<br>
</p>
<button type="submit" id="submit" name="submit" class="btn-lg btn-primary btn-block">submit (free , no obligation)</button>
</div>
</div>
<!--end form-->
</form>
<!--end col block-->
</div>
</div>
<p> </p>
<p> </p>
<p>you can send quick email <a href="mailto:loan@loanfinder.com.au">loan@loanfinder.com.au</a> details on require.</p>
<p> </p>
<p> </p>
<p>if want make process faster, send email to
<a href="mailto:loan@loanfinder.com.au">loan@loanfinder.com.au</a> copy of last 3 months business bank statements , copy of drivers licence.</p>
<p></p>
<!-- begin: constant contact email list form button -->
<div align="center">
<a class="button" style="padding: 8px 10px; border-radius: 20px; border: 1px solid rgb(91, 91, 91); border-image: none; color: rgb(255, 255, 255); display: inline-block; text-shadow: none; background-color: rgb(0, 103, 206);" href="https://visitor.r20.constantcontact.com/d.jsp?llr=4iis56yab&p=oi&m=1126286565663&sit=kjojh ralb&f=479f0d50-5f6a-450b-bf3e-b7f9c3045a86">keep updated</a>
<!-- begin: email marketing can trust -->
<div align="center" id="ctct_button_footer" style="color: rgb(153, 153, 153); font-family: arial,helvetica,sans-serif; font-size: 10px; margin-top: 10px;">keep updated , informed. add email here.</div>
</div>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<div class="container-fluid"></div>
<footer>©copyright 2016 loanfinder pty ltd</footer>
</div>
</div>
<!-- jquery (necessary bootstrap's javascript plugins) -->
<script src="js/jquery-1.11.3.min.js"></script>
<!-- include compiled plugins (below), or include individual files needed -->
<script src="js/bootstrap.js"></script>
<script>
(function (i, s, o, g, r, a, m) {
i['googleanalyticsobject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new date();
= s.createelement(o)
, m = s.getelementsbytagname(o)[0];
a.async = 1;
a.src = g;
m.parentnode.insertbefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'ua-86438859-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
More discussions in Dreamweaver support forum
adobe
Comments
Post a Comment