I'm trying to create a form (it's rather long, so I won't post it here in its entirety). I'd like there to be a function which validates one of the text fields without the need to submit the entire form. This is the particular part:
As you can guess I have a Javascript function which hides the link and shows one of the spans. What I'd like to do is for that function to validate the name by checking it with the database, without, as I said, the need to submit the entire form, and then displaying one of the two spans. Is there any way I can get PHP to do this?
(This may well belong in JS, but I decided as it's primarily a serverside matter it should go here)
Code:
<tr><td style="width: 50%"><strong>Username:</strong><br /><a id="checkuser1" style="font-size: 0.8em" href="#" onclick="checkUserName();">Check availability</a> <span id="checkuser1keep" style="display: none;"><img src="template/img/icon-cleared.png" alt="Cleared" width="15" height="15" /> <span style="color: green; font-family: Verdana, Arial, sans-serif; font-size: 0.7em;">That name is not currently in use.</span></span> <span id="checkuser1taken" style="display: none;"><img src="template/img/icon-taken.png" alt="Taken" width="15" height="15" /> <span style="color: red; font-family: Verdana, Arial, font-weight: bold; sans-serif; font-size: 0.7em;">That name is currently taken.</span></span> </td><td colspan="2" style="vertical-align: top;"><input onkeydown="undoCheckUserName()" id="usernamebox" type="text" name="uname" /></td></tr
(This may well belong in JS, but I decided as it's primarily a serverside matter it should go here)
Comment