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 7846145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:28:44+00:00 2026-06-02T17:28:44+00:00

I have designed a registration form which you can see here . It includes

  • 0

I have designed a registration form which you can see here. It includes a javascript validation script which handles everything apart from checking to see if the username already exists on a MySQL database.

The way this is currently handled is by a separate PHP page (register.php) which is called on submitting the form, and checks against the MySQL database, displaying some text if the username already exists with a link back to the html page with the registration form on.

I am wondering if there is a way to not have to load the new PHP page, but append an error message to the html form (as with all of the other validations) when the user tries to submit the form but the username already exists. Is the only way to do this to not have a separate PHP that the form posts to, but rather include all of the PHP from the second file (which connects to the database, checks the username, and adds the new user) in the main registration page?

I hope this is clear!

Thanks,

Nick

  • 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-02T17:28:47+00:00Added an answer on June 2, 2026 at 5:28 pm

    I assume you’re talking about an ajax request? If you don’t know what that is go ahead and google it you’ll find plenty of information on it.

    I always use a javascript library like jQuery or dojo which makes ajax a lot easier but maybe you don’t want to add the overhead of an entire javascript library for a little javascript use.

    The basic premise is:

    1. Your javascript sends a request to the server, in this case to your register.php page.
    2. The register.php file runs with the params you passed it in your ajax request.
    3. The javascript receives the response from the register.php file. In this case it’d probably be easiest to do something like:

      • If the username does exist return false, which then your javascript function can use on a callback to pop up a validation error.

      • If the username does NOT exist, then the register.php file could register/log them in and will return true to the javascript. The javascript will then redirect the user to the page that they were supposed to go to as if nothing ever happened in the background.

    For coding purposes here’s some psuedocode on how I would do it with jQuery:

    $.ajax({
      url:'register.php?username=theUsersName',
      dataType:'html',
      success:function(data){
        if (data)
          --redirect to homepage
        else
          --pop up validation error
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have designed a standalone application using swings which can read data from HID
I have designed a form where the user can enter his comment using Add
I have designed an online editor with which a user can create files and
I have designed a form which has code behind attached to IT. I have
I have designed a user profile form, a long form which is quite complicated.
I have designed a form using labels and textboxes and included validation but when
I have designed an e-commerce system whereby I have products which can belong to
I have Designed the Javascript function My.js it contains following code My.js function display(){
I have designed this gui in netBeans which has a canvas , a couple
I have designed one sign-up form,in this form after getting all necessary values I

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.