<?php 
//Gets values from database
$options = get_option('sfa_msg_settings');

if( isset($_POST['sfa_msg_form_submit'] )) 
{		
		$options['empty'] = $_POST['sfa_efield'];		
		$options['email_nv'] = $_POST['sfa_emailnv'];
		$options['w_captcha'] = $_POST['sfa_wcaptcha'];
		$options['e_captcha'] = $_POST['sfa_ecaptcha'];
		$options['e_phone'] = $_POST['sfa_phone'];
		$options['sub_req'] = $_POST['sfa_esub'];
		$options['success'] = $_POST['sfa_success'];		
		
		update_option('sfa_msg_settings', $options);
}

?>

<div class="wrap">
	<div id="icon-options-general" class="icon32"></div>
	<?php    echo '<h2>' . __( 'Simple AJAX Contact Form', 'sacf' ) . '</h2>'; ?> <br/>
	
		<div class="updated fade" <?php if( !isset( $_REQUEST['sfa_msg_form_submit'] )) echo 'style="display:none"'; ?>><p><strong><?php echo __('Settings saved.') ?></strong></p></div>

	<form id="sfa_settings_form" method="POST" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
			
			<p class="sfa-form-sub"><?php _e('Error Messages','sacf') ?></p>
			<label for="sfa_efield"><?php _e('Empty field:','sacf') ?></label>
			<input type="text" id="sfa_efield" class="inputType" name="sfa_efield" value="<?php echo $options['empty']; ?>" />	<div class="sfa_clear"></div>
			
			<label for="sfa_emailnv"><?php _e('Email no valid:','sacf') ?></label>
			<input type="text" id="sfa_emailnv" class="inputType" name="sfa_emailnv" value="<?php echo $options['email_nv']; ?>" /><div class="sfa_clear"></div>
			
			<label for="sfa_wcaptcha"><?php _e('Wrong Captcha:','sacf') ?></label>
			<input type="text" id="sfa_wcaptcha" class="inputType" name="sfa_wcaptcha" value="<?php echo $options['w_captcha']; ?>" /><div class="sfa_clear"></div>
			
			
			<label for="sfa_ecaptcha"><?php _e('Empty Capcha:','sacf') ?></label>
			<input type="text" id="sfa_ecaptcha" class="inputType" name="sfa_ecaptcha" value="<?php echo $options['e_captcha']; ?>" /><div class="sfa_clear"></div>
			
						
			<label for="sfa_phone"><?php _e('Empty Phone:','sacf') ?></label>
			<input type="text" id="sfa_phone" class="inputType" name="sfa_phone" value="<?php echo $options['e_phone']; ?>" /><div class="sfa_clear"></div>
						
			<label for="sfa_esub"><?php _e('Empty Subject:','sacf') ?></label>
			<input type="text" id="sfa_esub" class="inputType" name="sfa_esub" value="<?php echo $options['sub_req']; ?>" /><div class="sfa_clear"></div>
			
			<p class="sfa-form-sub"><?php _e('Success Message','sacf') ?></p>
			<label for="sfa_success"><?php _e('Success Message:','sacf') ?></label>
			<input type="text" id="sfa_success" class="inputType" name="sfa_success" value="<?php echo $options['success']; ?>" />	<div class="sfa_clear"></div>
			
			<input type="hidden" name="sfa_msg_form_submit" value="submit" />			<div class="sfa_clear"></div>
			
			<input class="button-primary" type="submit" name="Save" value="<?php _e('Update options', 'sacf'); ?>" id="submitbutton" />
	</form>
</div>
