test button to validate mysql info

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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

I want to have a button that a user can hit to valid mysql info
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>
             .... do mysql lookup here and let user know 'user' is
.... many more input types here ...
<input type=submit name="Submit">

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

Will it work this way?  If so what do I fill in in the button area?
Ive wondered if I need/should use javascript, but in looking around
the web it seemed that wouldnt work easily, or would it?
I know that the 'user' information is posted in the FORM, so Im
how to get it into the php section anyhow.

Thanks for any help

Re: test button to validate mysql info

Jeff wrote:
Quoted text here. Click to load it
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.

Re: test button to validate mysql info

On Sep 15, 12:22=A0pm, Harlan Messinger
Quoted text here. Click to load it

Ok so I figured that part out thank you.  I have the following:

function chk_user(form)
    url=3D"http://mysite.com/val.php?email=3D " + form.email.value +
"&user=3D" + form.user.value;

Is there any way to pass back what my php script returns via
window.open or is
there another javascript call I need to do so?

Is this even possible?

Based on the return value i want to display a different image or text
whatever I decide to do.

Thanks again

Re: test button to validate mysql info

Jeff wrote:
Quoted text here. Click to load it

I'm not sure that there aren't security restrictions that will prevent
this, depending on the browser, but

    var win = window.open(url);
    if (win.document....) ...

But doing this in another window is ugly. See information on
XMLHTTPRequest at http://en.wikipedia.org/wiki/XMLHttpRequest .

Site Timeline