Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
//this is register.js       

window.onload=initPage;
    var request;

    function initPage(){
        var submit=document.getElementById("submit");//<input type="submit" id="submit>"

        submit.onclick=getRegister;
    }

    function getRegister(){
        request=createRequest();
        if(request==null){
            alert("unable to create request");
            return;
        }

        var url="register.php";
        request.open("GET",url,true);
        request.onreadystatechange=checkAccount;
        request.send(null);
    }

    function checkAccount(){
        if(request.readyState==4){
        if(request.status==200){

        }
        }
    }


    function createRequest() {
      try {
        request = new XMLHttpRequest();
      } catch (tryMS) {
        try {
          request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (otherMS) {
          try {
            request = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (failed) {
            request = null;
          }
        }
      } 
      return request;
    }

I have a register.php,a register.js,a register.html and with a four input:account,password,nickname,email. I have to check whether the account is already in the database,I know how to interact with mysql using php,the confusion is I don't know how to interact js and php,and where to compare the account,could you please show me the code examples?Thank you.(I'm trying to build a website such like stackoverfolw but not that awesome...I'm trying to learn by myself..)

share|improve this question
 
sorry..not the whole application...just (I know how to interact with mysql using php,the confusion is I don't know how to interact js and php,and where to validate the account,could you please show me the code examples?).. –  user2947389 16 hours ago
add comment

put on hold as off-topic by deceze, Pranav 웃, Harry, Maerlyn, aquavitae 11 hours ago

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist" – deceze, Harry, Maerlyn, aquavitae
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

Unfortunatelly you are asking us to show you how to build a complete application. That is not possible on SO. This site was build to solve very specific problems and not to copy and paste full application codes.

Please read what questions to ask and and what to avoid

This is the reason you are being downvoted.

If you want to learn how applications like this are build then download some open source projects and learn by reading their code. I do not know if there is any stackoverflow like project in PHP, but there is one built with python. You can download OSQA and see how it is build.

There are also many other open source projects build with PHP which you could download and read their source code to learn.

I would suggest you to also read some books on the subject, and to start with a less overwhelming project.

Good luck.

share|improve this answer
 
thank you..not the whole application... I know how to interact with mysql using php,the confusion is I don't know how to interact javascript and php,and where to validate the account,could you please show me the code examples?(just for above) –  user2947389 16 hours ago
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.