Custom Formdata matching with user table
I am writing a code to match form input data with user table in wp, but its not working proper, either condition is true or false, its giving same message. please help me to resolve it.
function email_form_code() {
echo 'form action="' . esc_url( $_SERVER['REQUEST_URI'] ) . '" method="post"';
echo 'p';
echo 'p';
echo 'Your Email (required) br /';
echo 'input type="email" name="email" value="' . ( isset( $_POST["email"] ) ? esc_attr( $_POST["email"] ) : '' ) . '" size="40" /';
echo '/p';
echo 'pinput type="submit" name="submit" value="Send"//p';
echo '/form';
}
function checkpoint_email() {
global $wpdb;
if(isset($_POST['submit'])){
$email = sanitize_email($_POST['email']);
if(!is_email($email)) {
echo 'div class="error"pInvalid e-mail!/p/div';
}
$datum = $wpdb-get_results("SELECT COUNT(*) FROM wp8p_users WHERE $current_user-user_email = $email");
if($datum 0) {
echo "Email Verified";
}
else {
echo "Email Not Verified";
}
}
}
function ec_shortcode() {
ob_start();
checkpoint_email();
email_form_code();
return ob_get_clean();
}
add_shortcode( 'av_email_cform', 'ec_shortcode' );
?