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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:38:41+00:00 2026-05-24T11:38:41+00:00

I am creating a registration form using PHP and jquery with ajax. Each field

  • 0

I am creating a registration form using PHP and jquery with ajax. Each field is validated via jquery/ajax to a PHP backend. Once the form is all filled out, I would like to have all of the registration data sent via ajax to the PHP backend to be submitted to MySQL.

Someone recommended using JSON, which I am unfamiliar with. OOP is still largely alien to me, and I’m familiar with procedural design.

Here are some code snips for example sake. My registration form has four values that I’d want to submit (email, fullname, charactername, password) (though please don’t be distracted from my question, which I outline below)

a bit of jquery:

$('#fullname_field').blur(function(){
        //alert('test');
        var fullname = $('#fullname_field').val();

            $.ajax({
            url: "register_backend.php",
            type: 'POST',
            data: 'fullname=' + fullname,

                success: function(result) {
                //alert("a success");
                //alert(result);
                $('#fullname_status_return').empty();
                $('#fullname_status_return').append(result);

                }
            });

And the corresponding code on the PHP backend:

if (filter_has_var(INPUT_POST, "fullname")) {
    $fullname = mysql_real_escape_string(filter_input(INPUT_POST,'fullname'));
    $testvalue = $fullname;
    $shorttest = $fullname;
    $denychars = stripslashes($fullname);
}
if (strlen($shorttest) < '5')
{
 $echo  "This field is too short.";

} else   {
////////// end short test
////////// if string is not too short, it runs the rest of the code, otherwise this is     all it runs


$result = mysql_query("SELECT * FROM deniednames WHERE deniedname = '$testvalue'",$db);
if (!$result)
die(mysql_error());

$rowcheck = mysql_num_rows($result);
if ($rowcheck > '0') {
    echo "This name is forbidden, please choose another.";
}
}

My question is this:
When the user has filled out all of the fields, and hits a submit button, how can I send all of the fields over to PHP, and how can PHP intercept that and make it into usable data that I can validate and then throw into my db?

Breaking that down further, I’m uncertain how to use JSON to capture those values, or conversely, to inject them into JSON, then to provide that JSON to the PHP backend, and then to get the PHP code to accept the JSON input.

I’ve poured over JSON intros and info on the web, but I’m just not getting it, and would be very grateful for some enlightenment.

(here it is, live: http://www.dixieandtheninjas.net/dynasties/register.php )

  • 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-05-24T11:38:42+00:00Added an answer on May 24, 2026 at 11:38 am

    JSON is just a way to denote an object. In JS you can create an object literal by just declaring it with { and }, like

    var user = {name: 'jeremy'}
    

    You can ‘send’ that to PHP with the $.ajax function of jQuery (or any like it) and in PHP you can receive that as a normal $_POST or $_GET array.

    You can use jQuery to fetch the values from the input’s and put them into a data array. Find more on jQuery and ajax here: http://api.jquery.com/jQuery.ajax/. If you want to send a response in JSON from PHP, you can call json_encode on an array and echo that back.

    Does that help?

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

Sidebar

Related Questions

I'm creating a simple registration page: <?php $firstName = $_POST['firstName']; ?> <form action=registration.php method=post
I have a user registration form in PHP .I put captcha image check in
I'm creating a web app that requires registration/authentication, and I'm considering using an email
I am creating a registration form which contains two submit buttons. I need to
i am creating a registration form for that i want to implement the captcha
I'm creating registration page and I've done basic client side (JS) form validation. Now
I am creating a form with Registration Date, Renewal Date and Valid Upto fields
I am creating a registration form which include a great deal of data on
I am currently creating a registration form in asp.net and c#. What I want
I have a problem in creating an AJAX-based form submission which if its response

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.