Loading
Php AJAX FORM
PHP-AJAX Form
Conference has a built-in universal php-ajax form that can grab dynamic amounts of inputs and send it to any given email address. To make the form work, simply add the class .zform
like <form class="zform">
.
You can also specify where to send the data via an hidden input:
<input type="hidden" name="to" value="username@domain.extension">
Other reserved name
fields are: subject
, email
, name
See the sample code under the form bellow for better understanding.
<form class="zform pl-3" method="post">
<div class="form-group"><input class="form-control" type="hidden" name="to" value="username@domain.extension"></div>
<div class="form-group row"><label class="col-md-2 col-lg-1 pl-0 col-form-label text-left">Name :</label>
<div class="col-9"><input class="form-control" type="text" name="name" required=""></div>
</div>
<div class="form-group row"><label class="col-md-2 col-lg-1 pl-0 col-form-label text-left">Subject :</label>
<div class="col-9"><input class="form-control" type="text" name="subject" required=""></div>
</div>
<div class="form-group row"><label class="col-md-2 col-lg-1 pl-0 col-form-label text-left">Email :</label>
<div class="col-9"><input class="form-control" type="email" name="from" required=""></div>
</div>
<div class="form-group row"><label class="col-md-2 col-lg-1 pl-0 col-form-label text-left">Field One :</label>
<div class="col-9"><input class="form-control" type="text" name="field-1" placeholder="Optional"></div>
</div>
<div class="form-group row"><label class="col-md-2 col-lg-1 pl-0 col-form-label text-left">Field Two :</label>
<div class="col-9"><input class="form-control" type="text" name="field-2" placeholder="Optional"></div>
</div>
<div class="form-group row"><label class="col-md-2 col-lg-1 pl-0 col-form-label text-left">Message :</label>
<div class="col-9"><textarea class="form-control" rows="8" name="message" placeholder="Write your message here..."></textarea></div>
</div>
<div class="form-group row">
<div class="col-9 offset-lg-1 offset-md-2"><input class="btn btn-primary px-4 py-2" type="submit" name="submit" value="Send!"></div>
</div>
<div class="zform-feedback"></div>
</form>
Integrating reCaptcha
Get your secret and site key here ⟶
HTML
<form class="zform" method="post">
...
...
<div class="g-recaptcha" data-sitekey="YOUR_SITE_KEY"></div>
<input type="submit" value="Submit">
</form>
JavaScript
<script src="https://www.google.com/recaptcha/api.js"></script>
PHP
Open assets/php/form-processor.php
and change the secret key with yours at line: 13
$reCaptchaSecret = "YOUR_SECRET_KEY";