So I had a look at this. I’ve never tried jQuery, but it’s one of those things that looks like it might be useful. So basing some stuff on your code, and the code that others have suggested in the other thread you opened, here’s what I have got for the html code, a very basic form just to see how things work:
And I’ve got this very small bit of PHP, again just to see what happens
<?php
var_dump($_POST);
?>
So a few things I’ve learned from this:
You don’t need to unserialize the data when it arrives at the PHP code
The PHP code can output what it likes, and your browser won’t see it. It will appear in something like Chromelogger though.
I used the separate line to grab the data as someone wrote in the other thread. Partly because that makes it easier to read in my opinion. Editing it back to your $(“form-div form”) version works too.
So, your issue with the test script might be down to point two, that the PHP code just doesn’t output stuff to the browser when you’ve called it in this way. Or it might be the URL.
Grateful that you have stuck around till now. I eventually did some restructuring to the PHP code I posted earlier and it now runs and logs errors in the error log file. But variables from this point on refused to run meaning that SQL is wrong so I guess if anyone can help me correct it, we’ll be home and dry.
Missing opening single-quote before $last_name in the values section. Though you should look at prepared statements to make it nicer and would deal with quotes for you.
The Ajax code correctly displays the “email already registered” error when I input a preregistered email. But the bad news is, it also displays any output from the script if the email hasn’t been registered. Here’s my Ajax
Your problem there is that you’ve re-used $prep in the second line of your code, which was your pointer to the prepared statement. The result from bind_param() overwrites the pointer with either true or false, which causes a problem when you go on to call execute() on the same variable, so change it to something else.