• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Form and PHP code not working

Community Beginner ,
Nov 04, 2016 Nov 04, 2016

Copy link to clipboard

Copied

Hello,

Basically, I have developed a form to capture some basic details that I want to receive via email upon the user pressing submit.

I have followed the tutorials / google searches / examples with limited success so far. In the meantime, I am using a web built form generated by a third party. I want to have my own creation uploaded and understand how it works.

I got as far as the form creation using the following guide - Alt-Web Design & Publishing: Responsive Contact Form with Bootstrap 3.2 and PHP (Part 1)

I have saved a Work in Progress page - located here Get started. Enquire here for Loanfinder Business Loans.

The issue:

1. I added more fields and options than the guide above had and tried to update all the relevant links. I don't think I got it quite right, so will need to fix that up

2. I want the form to work so I receive an email upon submission and the user is redirected to a thankyou page. ( Article Description )

I will post relevant page codes below.

Views

828

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 05, 2016 Nov 05, 2016

OK.  This is from the Tutorial

// NOTE: this page must be saved as a .php file.
// And your server must support PHP 5.3+ PHP Mail().

#1 Does your server support PHP code and more specifically the PHP mail () function?  If unsure, contact your web host.

#2 Can you get the form & processing script to work without your additional form fields?

See link below for a working contact form.  Reply #6

Re: Help, Cant get my Web Form to send me an Email

#3 Names/IDs cannot contain spaces.  Stick with single wor

...

Votes

Translate

Translate
Community Beginner ,
Nov 04, 2016 Nov 04, 2016

Copy link to clipboard

Copied

This is the form code which appears to work to work.

<!--begin HTML Form-->
<form class="form-horizontal" role="form" 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="Business Name" placeholder="Business / Company Name">
</div>
</div>
<div class="form-group">
<label for="State" class="col-sm-3 control-label"> Select your 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="SA">NT</option>
<option value="SA">ACT</option>
<option value="SA">Other</option>
</select>

</div>
</div>
<p class="required">Time in Business
</p>
<p>
  <label>
    <input type="radio" name="Time In Business" value="radio" id="Less than 6 months">
    Less than 6 months</label>
  <br>
  <label>
    <input type="radio" name="Time In Business" value="radio" id="6 to 12 months">
    6 to 12 months</label>
  <br>
  <label>
    <input type="radio" name="Time In Business" value="radio" id="Over 1 year">
    Over 1 Year</label>
  <br>
</p>
<p class="required">Loan Amount Required
</p>
<p>
  <label>
    <input type="radio" name="Loan Size" value="radio" id="up to $50K">
    $5K to $50K</label>
  <br>
  <label>
    <input type="radio" name="Loan Size" value="radio" id="up to $250K">
    $50K to $250K</label>
  <br>
  <label>
    <input type="radio" name="Loan Size" value="radio" id="over $250K">
    Over $250K</label>
  <br>
</p>
<p> </p>
<div class="form-group">
  <p>
    <label>
      <input type="checkbox" name="PrivacyCheck" value="checkbox" id="PrivacyCheck">
      I have reviewed, understand and consent to the privacy policy</label>
    <br>
  </p>
</div>

<div class="form-group">
<div class="col-sm-offset-3 col-sm-6 col-sm-offset-3">
<button type="submit" id="submit" name="submit" class="btn-lg btn-primary btn-block">SUBMIT (Free and No obligation)</button>
</div>
</div>
<!--end Form--></form>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 04, 2016 Nov 04, 2016

Copy link to clipboard

Copied

This is the corresponding PHP - the current form is saved as a php page here - Get started. Enquire here for Loanfinder Business Loans.

<?php
// NOTE: this page must be saved as a .php file.
// And your server must support PHP 5.3+ and PHP Mail().
// Define variables and set to empty values
$result = $name = $email = $phone = $BusinessName = $State = $TimeInBusiness = $LoanSize = $PrivacyCheck = "";
$errName = $errEmail = $errPhone = "";
    if (isset($_POST["submit"])) {
        $name = $_POST['name'];
        $email = $_POST['email'];
        $phone = $_POST['phone'];
        $Businessname = $_POST['Businessname'];
        $State = $_POST['State'];
        $TimeInBusiness = $_POST['TimeInBusiness'];
        $LoanSize = $_POST['LoanSize'];
        $PrivacyCheck = $_POST['PrivacyCheck'];
     
             //valid address on your web server
        $from = 'loan@mywebsite.com.au';
        //your email address where you wish to receive mail
        $to = 'loan@mywebsite.com.au';
        $subject = 'Loan Enquiry';
        $headers = "From:$from\r\nReply-to:$email";
        $body = "From: $name\n E-Mail: $email\n Phone: $phone\n BusinessName: $BusinessName\n State: $State\n TimeInBusiness: $TimeInBusiness\n LoanSize: $LoanSize\n";
}
//end form processing script

// Check if name is entered
if (empty($_POST["name"])) {
$errName = "Please enter your name.";
} else {
    $name = test_input($_POST["name"]);
}
// Check if email is entered
if (empty($_POST["email"])) {
$errEmail = "Please enter your email address.";
} else {
    $email = test_input($_POST["email"]);
    // check if e-mail address is valid format
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
      $errEmail = "Invalid email format.";
    }
}
// Check if phone is entered
if (empty($_POST["phone"])) {
$phone = "Please enter your phone number.";
} else {
    $phone = test_input($_POST["phone"]);
}

//Check if privacy is entered
if (empty($_POST["PrivacyCheck"])) {
$errMessage = "Please check box for consent to privacy policy.";
} else {
    $message = test_input($_POST["PrivacyCheck"]);
}

   //sanitize data inputs   
   function test_input($data) {
   $data = trim($data);
   $data = stripslashes($data);
   $data = htmlspecialchars($data);
   $data = (filter_var($data, FILTER_SANITIZE_STRING));
   return $data;
}
// If there are no errors, send the email & output results to the form
if (!$errName && !$errEmail && !$errPhone &&  !$errPrivacyCheck) {
    if (mail ($to, $subject, $body, $from)) {
        $result='<div class="alert alert-success"><h2><span class="glyphicon glyphicon-ok"></span> Message sent!</h2><h3>Thank you for contacting us. Someone will be in touch with you soon.</h3></div>';
    } else {
        $result='<div class="alert alert-danger"><h2><span class="glyphicon glyphicon-warning-sign"></span> Sorry there was a form processing error.</h2> <h3>Please try again later.</h3></div>';
       }
    }

   //sanitize data inputs   
   function test_input($data) {
   $data = trim($data);
   $data = stripslashes($data);
   $data = htmlspecialchars($data);
   $data = (filter_var($data, FILTER_SANITIZE_STRING));
   return $data;
}

//end form processing script
?>

[email address changed by Mod]

Mod Note: Please ensure that you do not post valid personal details. These can be used by unsavoury elements to your detriment.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 04, 2016 Nov 04, 2016

Copy link to clipboard

Copied

Something went wrong with my previous post.

What I said was that I had removed some of the more awkward fields from the form in order to test the one below. Copy and paste the code into a new document with a PHP extension like in wip.php.

<?php

// NOTE: this page must be saved as a .php file.

// And your server must support PHP 5.3+ and PHP Mail().

// Define variables and set to empty values

$result = $name = $email = $phone = $BusinessName = $State = "";

$errName = $errEmail = $errPhone = "";

if (isset($_POST["submit"])) {

    $name = $_POST['name'];

    $email = $_POST['email'];

    $phone = $_POST['phone'];

    $businessName = $_POST['businessName'];

    $state = $_POST['state'];

    //valid address on your web server

    $from = 'loan@loanfinder.com.au';

    //your email address where you wish to receive mail

    $to = 'loan@loanfinder.com.au';

    $subject = 'Loan Enquiry';

    $headers = "From:$email\r\nReply-to:$email";

    $body = "From: $name\n E-Mail: $email\n Phone: $phone\n Business Name: $businessName\n State: $state\n";

}

//end form processing script

// Check if name is entered

if (empty($_POST["name"])) {

$errName = "Please enter your name.";

} else {

    $name = test_input($_POST["name"]);

}

// Check if email is entered

if (empty($_POST["email"])) {

$errEmail = "Please enter your email address.";

} else {

    $email = test_input($_POST["email"]);

    // check if e-mail address is valid format

    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

      $errEmail = "Invalid email format.";

    }

}

// Check if phone is entered

if (empty($_POST["phone"])) {

$phone = "Please enter your phone number.";

} else {

    $phone = test_input($_POST["phone"]);

}

// If there are no errors, send the email & output results to the form

if (!$errName && !$errEmail && !$errPhone) {

    if (mail ($to, $subject, $body, $from)) {

        $result='<div class="alert alert-success"><h2><span class="glyphicon glyphicon-ok"></span> Message sent!</h2><h3>Thank you for contacting us. Someone will be in touch with you soon.</h3></div>';

    } else {

        $result='<div class="alert alert-danger"><h2><span class="glyphicon glyphicon-warning-sign"></span> Sorry there was a form processing error.</h2> <h3>Please try again later.</h3></div>';

       }

    }

   //sanitize data inputs   

   function test_input($data) {

   $data = trim($data);

   $data = stripslashes($data);

   $data = htmlspecialchars($data);

   $data = (filter_var($data, FILTER_SANITIZE_STRING));

   return $data;

}

//end form processing script

?>

<!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 for Loanfinder Business Loans.</title>

    <meta name="description" content="Get started here. Loanfinder Business Loans. Loans approved and funded quickly for business based on your 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 and Respond.js for IE8 support of HTML5 elements and media queries -->

    <!-- WARNING: Respond.js doesn't work if you view the 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 it works.html">How it 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 do I apply?</h5>

            <p>Complete the quick form below and a loan consultant will contact you to discuss your requirements.</p>

            <p> </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 to finance your business</h3>

                    <p class="required small">Grow your business and manage your cash flow with an unsecured business loan.

                    </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 your 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="SA">NT</option>

                                    <option value="SA">ACT</option>

                                    <option value="SA">Other</option>

                                </select>

                            </div>

                        </div>

                        <div class="form-group">

                            <div class="col-sm-offset-3 col-sm-6 col-sm-offset-3">

                                <button type="submit" id="submit" name="submit" class="btn-lg btn-primary btn-block">SUBMIT (Free and No obligation)</button>

                            </div>

                        </div>

                        <!--end Form-->

                    </form>

                    <!--end col block-->

                </div>

            </div>

            <p> </p>

            <p> </p>

            <p>You can also send a quick email to <a href="mailto:loan@loanfinder.com.au">loan@loanfinder.com.au</a> with details on what you require.</p>

            <p> </p>

            <p> </p>

            <p>If you want to make the process faster, send an email to <a href="mailto:loan@loanfinder.com.au">loan@loanfinder.com.au</a> with a copy of your last 3 months business bank statements and a copy of your 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=kjojhralb&f=479...">Keep Updated</a>

                <!-- BEGIN: Email Marketing you 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 yourself updated and informed. Add your email here.</div>

            </div>

            <p> </p>

            <p> </p>

            <p> </p>

            <p> </p>

            <p> </p>

            <div class="container-fluid"> </div>

            <footer>&copy;Copyright 2016 Loanfinder Pty Ltd</footer>

        </div>

    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->

    <script src="js/jquery-1.11.3.min.js"></script>

    <!-- Include all compiled plugins (below), or include individual files as needed -->

    <script src="js/bootstrap.js"></script>

    <script>

        (function (i, s, o, g, r, a, m) {

            i['GoogleAnalyticsObject'] = r;

            i = i || function () {

                (i.q = i.q || []).push(arguments)

            }, i.l = 1 * new Date();

            a = 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>

Upload, because it is most likely that you do not have an email server on your local machine. Test and let me know.

After that, we'll include the remaining fields.

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 04, 2016 Nov 04, 2016

Copy link to clipboard

Copied

Ben,

If I copy and paste the code, the code line numbers duplicate over creating syntax errors for the whole code.

Can you paste without the line references?

Edit - I removed the numbers on each line and have saved it to the remote server.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 04, 2016 Nov 04, 2016

Copy link to clipboard

Copied

<?php

// NOTE: this page must be saved as a .php file.

// And your server must support PHP 5.3+ and PHP Mail().

// Define variables and set to empty values

$result = $name = $email = $phone = $BusinessName = $State = "";

$errName = $errEmail = $errPhone = "";

if (isset($_POST["submit"])) {

    $name = $_POST['name'];

    $email = $_POST['email'];

    $phone = $_POST['phone'];

    $businessName = $_POST['businessName'];

    $state = $_POST['state'];

    //valid address on your web server

    $from = 'loan@loanfinder.com.au';

    //your email address where you wish to receive mail

    $to = 'loan@loanfinder.com.au';

    $subject = 'Loan Enquiry';

    $headers = "From:$email\r\nReply-to:$email";

    $body = "From: $name\n E-Mail: $email\n Phone: $phone\n Business Name: $businessName\n State: $state\n";

}

//end form processing script

// Check if name is entered

if (empty($_POST["name"])) {

$errName = "Please enter your name.";

} else {

    $name = test_input($_POST["name"]);

}

// Check if email is entered

if (empty($_POST["email"])) {

$errEmail = "Please enter your email address.";

} else {

    $email = test_input($_POST["email"]);

    // check if e-mail address is valid format

    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

      $errEmail = "Invalid email format.";

    }

}

// Check if phone is entered

if (empty($_POST["phone"])) {

$phone = "Please enter your phone number.";

} else {

    $phone = test_input($_POST["phone"]);

}

// If there are no errors, send the email & output results to the form

if (!$errName && !$errEmail && !$errPhone) {

    if (mail ($to, $subject, $body, $from)) {

        $result='<div class="alert alert-success"><h2><span class="glyphicon glyphicon-ok"></span> Message sent!</h2><h3>Thank you for contacting us. Someone will be in touch with you soon.</h3></div>';

    } else {

        $result='<div class="alert alert-danger"><h2><span class="glyphicon glyphicon-warning-sign"></span> Sorry there was a form processing error.</h2> <h3>Please try again later.</h3></div>';

       }

    }

   //sanitize data inputs   

   function test_input($data) {

   $data = trim($data);

   $data = stripslashes($data);

   $data = htmlspecialchars($data);

   $data = (filter_var($data, FILTER_SANITIZE_STRING));

   return $data;

}

//end form processing script

?>

    <!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 for Loanfinder Business Loans.</title>

        <meta name="description" content="Get started here. Loanfinder Business Loans. Loans approved and funded quickly for business based on your 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 and Respond.js for IE8 support of HTML5 elements and media queries -->

        <!-- WARNING: Respond.js doesn't work if you view the 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 it works.html">How it 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 do I apply?</h5>

                <p>Complete the quick form below and a loan consultant will contact you to discuss your requirements.</p>

                <p> </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 to finance your business</h3>

                        <p class="required small">Grow your business and manage your cash flow with an unsecured business loan.

                        </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 your 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="SA">NT</option>

                                        <option value="SA">ACT</option>

                                        <option value="SA">Other</option>

                                    </select>

                                </div>

                            </div>

                            <div class="form-group">

                                <div class="col-sm-offset-3 col-sm-6 col-sm-offset-3">

                                    <button type="submit" id="submit" name="submit" class="btn-lg btn-primary btn-block">SUBMIT (Free and No obligation)</button>

                                </div>

                            </div>

                            <!--end Form-->

                        </form>

                        <!--end col block-->

                    </div>

                </div>

                <p> </p>

                <p> </p>

                <p>You can also send a quick email to <a href="mailto:loan@loanfinder.com.au">loan@loanfinder.com.au</a> with details on what you require.</p>

                <p> </p>

                <p> </p>

                <p>If you want to make the process faster, send an email to <a href="mailto:loan@loanfinder.com.au">loan@loanfinder.com.au</a> with a copy of your last 3 months business bank statements and a copy of your 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=kjojhralb&f=479...">Keep Updated</a>

                    <!-- BEGIN: Email Marketing you 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 yourself updated and informed. Add your email here.</div>

                </div>

                <p> </p>

                <p> </p>

                <p> </p>

                <p> </p>

                <p> </p>

                <div class="container-fluid"> </div>

                <footer>&copy;Copyright 2016 Loanfinder Pty Ltd</footer>

            </div>

        </div>

        <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->

        <script src="js/jquery-1.11.3.min.js"></script>

        <!-- Include all compiled plugins (below), or include individual files as needed -->

        <script src="js/bootstrap.js"></script>

        <script>

            (function (i, s, o, g, r, a, m) {

                i['GoogleAnalyticsObject'] = r;

                i = i || function () {

                    (i.q = i.q || []).push(arguments)

                }, i.l = 1 * new Date();

                a = 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>

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 04, 2016 Nov 04, 2016

Copy link to clipboard

Copied

The new link to the WIP.php page is http://www.loanfinder.com.au/WIP.php

When I enter details and press submit, the screen goes blank, but the form looks correct

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 05, 2016 Nov 05, 2016

Copy link to clipboard

Copied

OK.  This is from the Tutorial

// NOTE: this page must be saved as a .php file.
// And your server must support PHP 5.3+ PHP Mail().

#1 Does your server support PHP code and more specifically the PHP mail () function?  If unsure, contact your web host.

#2 Can you get the form & processing script to work without your additional form fields?

See link below for a working contact form.  Reply #6

Re: Help, Cant get my Web Form to send me an Email

#3 Names/IDs cannot contain spaces.  Stick with single word tokens for your added input fields -- i.e. name, email, phone, bus_name, etc...

#4 PHP code is cAsE sEnSiTiVe.  So form variables and names must match eXaCtLy or your script won't work.

Nancy O.

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 05, 2016 Nov 05, 2016

Copy link to clipboard

Copied

Nancy,

Thankyou for your reply.

In response:

#1 - I thought so, previous website going back 10 years allowed form email to be sent. I sent the current host an email to clarify if PHP Mail () was enabled and available. When I log on to my hosting account, it suggest it is. ( see pic )Server101.png

#2 - I created a new page in PHp and uploaded the code ( changing the email address to my domain ), - Link to page - Bootstrap Form and PHP Script . The form appears correctly, I enter the details and the screen goes blank. I tried the same for both IE and Chrome to make sure it wasn't a browser issue. No emails have come through despite the lack of acknowledgment upon pressing submit.

#3 & #4 - noted, but do not appear to be the issue

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 05, 2016 Nov 05, 2016

Copy link to clipboard

Copied

I did some further testing to see if PHP was enabled.

I followed this script available at Simple PHP Mail test • Conetix

I then uploaded this script to the remote server at a new page - http://www.loanfinder.com.au/formtest2.php

<?php

    ini_set( 'display_errors', 1 );

     error_reporting( E_ALL );

   $from = "my email@mywebsite";    (changed email address to mine)

   $to = "my email@mywebsite.com.au";      (changed email address to mine )

       $subject = "PHP Mail Test script";

    $message = "This is a test to check the PHP Mail functionality";

    $headers = "From:" . $from;

    mail($to,$subject,$message, $headers);

    echo "Test email sent";

?>

This worked and a test email was received. Does this suggest that PHP Mail ( ) is active ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 05, 2016 Nov 05, 2016

Copy link to clipboard

Copied

When I hit SUBMIT without entering data, I get this which tells me at least a portion of the script is working.   BUT your server may not have PHP mail () enabled.  And that's very important for this to work.  If your server uses SMTP to send emails, you need a different kind of script.

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 05, 2016 Nov 05, 2016

Copy link to clipboard

Copied

ok.

I will wait until the host replies to clarify if PHP Mail ( ) is enabled or possible.

If a host change is required, are there any good suggestions ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 07, 2016 Nov 07, 2016

Copy link to clipboard

Copied

LATEST

I received a reply:

We support the mail function. I checked and your account
was on PHP 4, so I have upgraded it to PHP 5.4. If you were experiencing
issues, this is most likely why. Please let us know if you have any further
issues.

after getting initial errors, it now appears to be working.

I would like to get the coding updated to include check boxes now, so will start testing that in a separate page to maintain the integrity of the existing test pages.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines