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

  • SEARCH
  • Home
  • 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 9050921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:46:31+00:00 2026-06-16T12:46:31+00:00

I have a simple html form for the user confirmation. Once the user registers

  • 0

I have a simple html form for the user confirmation. Once the user registers they are sent a link to this page with a GET variable attached like this: http://mysite/confirm?code=xyz123

I am using the jquery validation plugin for all my form validations.

I have this validation code:

<script type="text/javascript" language="javascript">
    $(document).ready(function(){
        $('#confirm').validate(
        {rules: {
            code: {
                required: true,
                minlength: 32,
                maxlength: 32
            }
        },

        messages: {
            code: {
                required: "Please enter the confirmation code",
                minlength: "Confirmation code is {0} characters",
                maxlength: "Confirmation code is {0} characters"
            }
        },
        submitHandler: function(form){
            $.get("confirmnewuser.php",
                $('#code').val,
                function(data){
                    if(data.status == 0){
                        $('#message').append("<span class='error'>Error: " + data.message + "</span>");
                    }
                    else{
                        $('.container').hide();
                        $('.short_explanation').hide();
                        $('#message').append("<span>" + data.message + "</span>");
                    }
                },
            "json");
        }
        });
    });
</script>

I would like to test if the GET['code'] variable is set which can be done easily like this:

var $_GET = <?php echo json_encode($_GET); ?>;

But at this point I don’t know where to add this to my existing validation code and I don’t know how to call the form submit handler (I’m fairly new to jquery/javascript).

Alternatively if the GET variable is not set then the page should load normally and the user can then enter their code in the input box.

Edit: added Form Code

    <form id='confirm' method='get' accept-charset='UTF-8'>

<div class='short_explanation'>* required fields</div>

<div id='message'></div>
<div class='container'>
    <label for='code' >Confirmation Code:* </label><br/>
    <input type='text' name='code' id='code' maxlength="32" /><br/>
</div>
<div class='container'>
    <input type='submit' name='submit' id="submit" value='Confirm' />
</div>
</form>
  • 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-16T12:46:33+00:00Added an answer on June 16, 2026 at 12:46 pm

    As I understand the situation is,

    if user comes with this url-> http://mysite/confirm

    The page will load normally, and user will enter its own code, then click the submit button.

    But if user comes with this url-> http://mysite/confirm?code=xyz123

    Form will load with defualt code “xyz12”, and submit automatically.

    If this is right than here is my solution,

    $(document).ready(function(){
       var defaultCode = <?php echo json_encode($_GET); ?>;
        if (defaultCode != "") {
           $('#code').val(defaultCode); //set code
           $('#confirm').submit(); //submit form, so submitHandler will handle it
        }
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an HTML page with a simple form. When the user clicks submit,
i have this simple html form: <form action=test/ method=get accept-charset=utf-8> <input type=text name=first value=
i have this simple html form: <form action=test/ method=get accept-charset=utf-8> <input type=text name=first value=
I have a simple html form. This form has a specific width and margin
I have a simple html form that looks like the following <form action=search.php method=get>
I have a simple html form. On php page. A simple list is placed
I have a simple html form that is structured something like this: <form name=test
I have a relatively simple HTML / JavaScript form. Such as this: <form method='POST'
I have a simple HTML Form that allows the user to enter some text
I have a simple HTML form which consists of radio buttons where user has

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.