Index.php Code
<?php
function wps_query_form()
{
require_once('template/form.php');
}
function wps_home_form_callback()
{
$req = $_REQUEST;
add_filter( 'wp_mail_content_type', 'wps_set_html_content_type' );
$to = "$adminmail,$email";
$subject = 'Uw aanmelding bij BespaarAutomatisch.nl';
wp_mail( $to, $subject, $body );
remove_filter( 'wp_mail_content_type', 'wps_set_html_content_type' );
echo "success";
exit();
}
function wps_set_html_content_type()
{
return 'text/html';
}
function wps_replace_string($content,$aStrings)
{
if($aStrings)
{
foreach($aStrings as $aKey => $aString)
{
$content = str_replace($aKey,$aString,$content);
}
}
return $content;
}
add_action( 'wp_ajax_wps_home_form', 'wps_home_form_callback');
add_action('wp_ajax_nopriv_wps_home_form', 'wps_home_form_callback');
Form.php
<?php
?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery( ".vinr" ).click(function( event ) {
jQuery(this).find('input').prop('checked', true);
});
jQuery( ".contactform" ).submit(function( event ) {
url = "<?php echo admin_url( 'admin-ajax.php' ); ?>";
var data = jQuery( this ).serialize();
jQuery.post(url, data, function(response) {
if(response)
{
if(response == "success")
{
jQuery(".formMsg").html('Uw gegevens zijn succesvol verzonden.');
setTimeout(function(){
// location.reload();
},3000);
}
}
});
return false;
});
});
</script>
<form name="contactform" method="post" class="contactform" id="contactform" action="#">
<input type="hidden" name="action" value="wps_home_form" />
<!-- Progress Bar -->
<!-- Fieldsets -->
<p class="subtitle">Vult u eerst uw jaarverbruik in.</p>
<p class="subtitle">Als u het niet precies weet,kunt u de samenstelling van uw huishouden aanklikken.</p>
<div class="col-md-6 col-sm-6">
<p class="sfinput"><b> Elektriciteit </b><span class="fspan">kwh</span><input type="text" name="elektriciteit" maxlength="50" size="30" id="elektriciteit" class="demoInputBox"> <span id="userName-info" class="info"></span> <p class="fcheck"> Geen Elektriciteit <input type="checkbox" name="geen" value="Geen Elektriciteit" id="radio6"> </p></p>
</div>
<div class="col-md-6 col-sm-6">
<p class="sfinput"><b> Gasverbruik </b><span class="fspan">M3</span><input type="text" name="gasverbruik" maxlength="50" size="30" id="gasverbruik"> <p class="fcheck"> Geen Gasverbruik <input type="checkbox" name="geen" value="Geen Gasverbruik" id="radio7"> </p></p>
</div>
<input name="next" type="submit" value="<?php _e( 'VERSTUUR', 'bafreelance' ); ?>">
</fieldset>
<fieldset>
<h1><div class="formMsg"></div> </h1>
</fieldset>
</form>
form.html
<h1> hello </h1>
<?php
function wps_query_form()
{
require_once('template/form.php');
}
function wps_home_form_callback()
{
$req = $_REQUEST;
add_filter( 'wp_mail_content_type', 'wps_set_html_content_type' );
$to = "$adminmail,$email";
$subject = 'Uw aanmelding bij BespaarAutomatisch.nl';
wp_mail( $to, $subject, $body );
remove_filter( 'wp_mail_content_type', 'wps_set_html_content_type' );
echo "success";
exit();
}
function wps_set_html_content_type()
{
return 'text/html';
}
function wps_replace_string($content,$aStrings)
{
if($aStrings)
{
foreach($aStrings as $aKey => $aString)
{
$content = str_replace($aKey,$aString,$content);
}
}
return $content;
}
add_action( 'wp_ajax_wps_home_form', 'wps_home_form_callback');
add_action('wp_ajax_nopriv_wps_home_form', 'wps_home_form_callback');
Form.php
<?php
?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery( ".vinr" ).click(function( event ) {
jQuery(this).find('input').prop('checked', true);
});
jQuery( ".contactform" ).submit(function( event ) {
url = "<?php echo admin_url( 'admin-ajax.php' ); ?>";
var data = jQuery( this ).serialize();
jQuery.post(url, data, function(response) {
if(response)
{
if(response == "success")
{
jQuery(".formMsg").html('Uw gegevens zijn succesvol verzonden.');
setTimeout(function(){
// location.reload();
},3000);
}
}
});
return false;
});
});
</script>
<form name="contactform" method="post" class="contactform" id="contactform" action="#">
<input type="hidden" name="action" value="wps_home_form" />
<!-- Progress Bar -->
<!-- Fieldsets -->
<p class="subtitle">Vult u eerst uw jaarverbruik in.</p>
<p class="subtitle">Als u het niet precies weet,kunt u de samenstelling van uw huishouden aanklikken.</p>
<div class="col-md-6 col-sm-6">
<p class="sfinput"><b> Elektriciteit </b><span class="fspan">kwh</span><input type="text" name="elektriciteit" maxlength="50" size="30" id="elektriciteit" class="demoInputBox"> <span id="userName-info" class="info"></span> <p class="fcheck"> Geen Elektriciteit <input type="checkbox" name="geen" value="Geen Elektriciteit" id="radio6"> </p></p>
</div>
<div class="col-md-6 col-sm-6">
<p class="sfinput"><b> Gasverbruik </b><span class="fspan">M3</span><input type="text" name="gasverbruik" maxlength="50" size="30" id="gasverbruik"> <p class="fcheck"> Geen Gasverbruik <input type="checkbox" name="geen" value="Geen Gasverbruik" id="radio7"> </p></p>
</div>
<input name="next" type="submit" value="<?php _e( 'VERSTUUR', 'bafreelance' ); ?>">
</fieldset>
<fieldset>
<h1><div class="formMsg"></div> </h1>
</fieldset>
</form>
form.html
<h1> hello </h1>
Comments
Post a Comment