jeudi 1 juillet 2021

transfer vlaues with if and elseif

I want to confirm the user's identity in the registration form using SMS. How can I transfer $number in this form with $_POST['verifysbt'] ?

if(isset($_POST['regsbt'])){
    $data = $_POST['userl'];
    $number = $data['user_tel'];
    $result = $usobj->checkUser($number);
    if(!$result){
        ($remotePost->SendCode($number)); //send code With SMS
        echo '<input type="text" class="form-control" name="code" id="txt-username" required placeholder="return your code">
            <input type="hidden" value="'.$number.'" name="phone">
            </div>
            <div class="form-group">
            <input type="submit" name="verifysbt"  value="return" class="btn float-right login_btn">';
    }
}elseif(isset($_POST['verifysbt'])){                                
    $code = $_POST['code'];
    $phone = $_POST['phone'];
    $verify = $remotePost->IsCodeValid($phone,$code); //check verify code
    if($verify == "true"){
        echo "code is valid";
    }else{
        echo"code is invalid";
    }
}else{
    echo '
        <form method="POST">
        <input type="text" name="userl['name']">
        <input type="text" name="userl['lastname']">
        <input type="password" name="userl['password']">
        <input type="text" name="userl['number']">
        </form>';
}

Aucun commentaire:

Enregistrer un commentaire