Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8409255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:51:26+00:00 2026-06-09T23:51:26+00:00

I have ‘cloned’ a script, except for the variables the script is exactly the

  • 0

I have ‘cloned’ a script, except for the variables the script is exactly the same as the original! But it just doesn’t entirely work. it get stuck at:

if(validConnection=="")
{
   $('#UsernameConnection').css('border-color','#00ff00');
   $('.ErrorUsernameConnection').text('');
   checkUsername1 = true;
}

(the rest of the code is below)

I have been checking if I made some mistake in changing the varables but they all seem to match properly. What is wrong? How comes it work fine just with different variables and not this time???

Here is the HTML:

<div id="Connection">   
<div class="Connection">
    Connection
    <a href="#" id="HideConnection"><strong>×</strong></a>  
</div>

<?php connection(); ?>

<div class="formConnection">
    <form method="POST" autocomplete="off" name="Connection">
        <label for="Connection">Username:</label><br/>
        <input type="text" name="UsernameConnection" id="UsernameConnection"/><br/>
        <span class="ErrorUsernameConnection"></span><br/>
        <label for="Connection">Password:</label><br/>
        <input type="password" name="PasswordConnection" id="PasswordConnection"/>
        <span class="ErrorPasswordConnection"></span><br/>
        <input type="checkbox" name="checkbox"/><label>Remember me</label><br/>
        <input type="submit" name="Connection" value="Log In" id="Connection" class="LogIn"/>       
    </form>
</div>

Here is the php:

    <?php
    if(isset($_POST['UsernameConnection']))
    {
        $Username1 = $_POST['UsernameConnection'];

        if(preg_match("/^([a-zA-Z0-9àáâãäåçèéêëìíîïðòóôõöùúûüýÿ]{1,}[._-\s]?)+[a-zA-Z0-9àáâãäåçèéêëìíîïðòóôõöùúûüýÿ]{1,}$/",$Username1))
        {
            echo "";
        }else
        {
            echo "Invalid";
        }
    }       
?>

and JS:

    $(document).ready(function(){

    var checkUsername1 = false;


    $('#UsernameConnection').keyup(function(){

        var Username1 = $('#UsernameConnection').val();

        if(Username1=="")
        {   
            $('#UsernameConnection').css('border-color','red');
            $('.ErrorUsernameConnection').text('Error message 1');
            checkUsername1 = "Username empty";
        }else
        {
            $.post('fonctions/validUsernameConnection.php',{Username1:Username1},function(validConnection)
            {
                $('.ErrorUsernameConnection').text(validConnection);

                if(validConnection=="")
                {
                    $('#UsernameConnection').css('border-color','#00ff00');
                    $('.ErrorUsernameConnection').text('');
                    checkUsername1 = true;
                }else
                {
                    $('#UsernameConnection').css('border-color','orange');
                    checkUsername1 = "Username Invalid";
                }
            });
        }
    });
});

PS: I’m a little bit lost with all the stack’s sites so forgive me if this isn’t the right one to post this =/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:51:27+00:00Added an answer on June 9, 2026 at 11:51 pm

    the problems seems to be with this line

    $.post('fonctions/validUsernameConnection.php',{Username1:Username1},
    function(validConnection)
    

    In your PHP you should check for $_POST[‘Username1’] instead of $_POST[‘UsernameConnection’]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have converted devise new session from erb to Haml but doens't work, this is
Have deployed numerous report parts which reference the same view however one of them
I have just tried to save a simple *.rtf file with some websites and
Have searched the database but need to specifically sum(of hours flown or days off)in
Have posting working wonderfully, and reading the response happily EXCEPT when one of the
Have searched for the answer but no joy, so here goes... I'm working on
Have just started using Google Chrome , and noticed in parts of our site,
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have you managed to get Aptana Studio debugging to work? I tried following this,
Have a recurring situation, petty I know, but I'd like to consolidate the following:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.