I've gotten the hang of using PHP and javascript (as well as jQuery and some other libraries) fine.
The problem I have is how to properly exchange data. I know I can use POST
and GET
, but I usually only manage to do one sided communication, so I either send something to the server and let it work with the data (usually saving to a DB) or send the user over to a php page with some parameters.
What I need to do specifically is check our database to see if the user is already registered or not, and then warn the user with something such as "this email address is already in use".
I have this simple input form in my main page for registration:
<form>
<input type="text" name="name" placeholder="Name:" required="required">
<input type="email" name="email" placeholder="email:" required="required">
<input type="text" name="cel" placeholder="cel:" required="required">
<input type="submit" name="submit" formaction="register.php" value="reg">
</form>
Over on register.php
I know what I need to do to check if the email address exists in the DB, but I have no idea how to send this information back to the client. I use a mySQL DB, currently testing in the localhost with xampp.