Only some emails are valid on Subscription form...?

My subcription button is giving the error message (please enter valid id) to ONLY some users on mobile devices. The same email is accepted on other mobile devices. I can’t figure out what’s going on. Please help

[php]<?php

$insert = FALSE;;

if( is_email( $_POST[‘subscriber_email’] ) ) {

global $wpdb;

$wpdb->hide_errors();



if ( isset($_POST['subscriber_email']) ) {



    //add subscriber email to database

    $insert = $wpdb->insert(

                "{$wpdb->prefix}maintenance_page",

                array(

                  'email' => $_POST["subscriber_email"],

                  'insert_date' => current_time('mysql', true)

                ),

                array(

                  '%s',

                  '%s'

                )

            );

}

} else {

$email = isset( $_POST['subscriber_email'] ) ? $_POST["subscriber_email"] : FALSE;

$erroResponse = __('Enter a Valid Email Id','maintenance-page'); ?>

    <script>

        var erroResponse = '<?php echo $erroResponse; ?>';

        jQuery(document).ready(function($) {

            $(".inputsubs").attr("placeholder", erroResponse );

            $(".email-field").addClass('alert');

            $(".inputsubs").css('color','RED');

        });

    </script>

<?php

}

if (!$insert === FALSE) {

$response = __('You successfully subscribed. Thanks!','maintenance-page');?>

<script>

    jQuery(document).ready(function($) {

        var response = '<?php echo $response; ?>';

        $(".sign-up").html(response);

        $('.sign-up').addClass('response').removeClass('sign-up'); 

    });

</script>
<?php } ?>[/php]

Well what’s going on is easy to explain - Why is it happening is the hard part…

This returns false

[php] if ( isset($_POST[‘subscriber_email’]) ) {[/php]

Which means it, their isn’t anything in the form variable $_POST[‘subscriber_email’]

Why is it blank on some mobile devices, it’s very hard to tell, because we don’t see any of the HTML that’s being submitted in the code you posted.

Where did you find this script? It doesn’t logically make sense, (excerpt only)
[php]
if( is_email( $_POST[‘subscriber_email’] ) ) {
if ( isset($_POST[‘subscriber_email’]) ) {
// removed
}
} else {
$email = isset( $_POST[‘subscriber_email’] ) ? $_POST[“subscriber_email”] : FALSE;
$erroResponse = __(‘Enter a Valid Email Id’,‘maintenance-page’); ?>
// removed
}[/php]

So, if it is a valid email (which has a better function to validate actually): Then, if it isset? Seem strange to anyone else?

It’s a cluster f&*#

Sponsor our Newsletter | Privacy Policy | Terms of Service