Wednesday 11 November 2020

Page does not loads when I try to show error massage php

I am trying to show a duplicate error on form but this function crashes the page and the page does not load. If possible please help me configure php.ini for this

this is the function with that i am trying to shows the error messages in form page

public function getError($error) {
    if(!in_array($error, $this->errorArray)) {
        $error = "";
    }
    return "<span class='errorMessage'>$error</span>";
}

This is the function which i am trying to use to get the error in the array

private function validateEmails($em) {
    $checkEmailQuery = mysqli_query($this->con,"SELECT email FROM member_forms WHERE email='$em'");
    if(mysqli_num_rows($checkEmailQuery) != 0){
        array_push($this->errorArray, Strings::$emExists);
    return;
    }
}

These functions double-check with the database and if an error occurs, <?php echo $account->getError(Strings::$emExists); ?> should display it, but it does not and the page doesn't load. When the error occurs it goes until the error but it does not render anything and the body of the HTML page goes empty

HTML

        <div class="form-group" style="padding-left: 0px;">
            <p>
                <?php echo $account->getError(Strings::$fnCharacters); ?>

                <div class="col-md-3 indent-small">
                    <div class="form-group internal">
                        <input class="form-control" id="firstName"
                            name="firstName" type="text"
                            placeholder="First Name"
                            style="width: 180%;/*! padding-right: ; */margin: 0px 0px 0px 12px;"
                            value="<?php getInputValue('firstName')?>" required>
                    </div>
                </div>

                <div class="col-md-3 indent-small"
                    style="margin-left: 15px;width: 25%;">
                    <div class="form-group internal">
                        <input class="form-control" id="lastName"
                            name="lastName" type="text" placeholder="Last Name"
                            style="width: 188%;/*! padding-left: 33px; */margin-left: 56px;"
                            value="<?php getInputValue('lastName')?>" required>
                    </div>
                </div>

            </div>
        </div>
    
        <div class="form-group">
            <label class="control-label col-md-2 col-md-offset-2" for="email"
                style="margin-left: 0;width: 28%;/*! float: left; */">E-mail
                Address</label>
            <div class="col-md-6">
                <div class="form-group">
                    <div class="col-md-11">
                        <p>
                            <?php echo $account->getError(Strings::$emExists); ?>
                            <input class="form-control" id="email" name="email"
                                type="email" placeholder="Your E-mail..."
                                style="width: 156%;"
                                required>
                        </p>
                    </div>
                </div>
            </div>
        </div>
        


from Page does not loads when I try to show error massage php

No comments:

Post a Comment