Re: test button to validate mysql info



Jeff wrote:
I know how to use php/mysql, but the html aspect of
what Im trying to do (if its even possible this way) is what Im
unsure
of.

I want to have a button that a user can hit to valid mysql info
before
submitting the full page of info. I know this doesnt work, but
something like the following:


<form method=POST action="http://mysite.com/send.php";>
<input type=text name=user>
<button>
<?php
.... do mysql lookup here and let user know 'user' is
valid....
?>
</button>
.... many more input types here ...
<input type=submit name="Submit">
</form>


Im unsure if A) it will work this way and B) how do even do this?

Your PHP is back at the server. It isn't going to do anything until something has been submitted to it for processing.

If you want to validate something within the browser, you need to use Javascript. You *can* use AJAX or some other means of communicating with the server without submitting the form, using Javascript to send the request and process the response. You'd need to have a separate PHP resource on the server to handle that kind of request and return the appropriate response, which might be plain text, might be encoded as XML, or might take some other form.
.


Loading