Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2007
    Location
    Essex, England
    Posts
    1,392
    Tokens
    0

    Latest Awards:

    Default Javascript and PHP

    Right, well I've made a simple javascripty login-ma-jig.

    Basically, from here, how do I make it so php processes the inputted data?

    Here is the javascript, what now?

    +REP TO ALL HELP

    Code:
    function login() {
        
        var inUsername = prompt("What is your username?");
        if(inUsername=="") {
            
            alert("Sorry, you left out the username field.");
            
        } else {
            
            var inPassword = prompt("What is your password, " + inUsername + "?");
            if(inPassword=="") {
                
                alert("Sorry, you left out the password field.");
                
            } else {
                
                PROCESS PASSWORD HERE
                
            }
            
        }
        
    }

    Thread moved from Design and development by --ss-- (Forum Super Moderator): Please post in the correct section .
    Last edited by --ss--; 04-06-2008 at 07:43 PM.


  2. #2
    Join Date
    May 2008
    Location
    Cheshire
    Posts
    133
    Tokens
    0

    Default

    You'd need to make it a real form first, since i dont know weather php does the javascript prompts.

    HTML Code:
    <style type="text/css">
    <!--
    .style1 {color: #0066FF}
    .style2 {
        font-family: Arial;
        font-size: 16px;
    }
    -->
    </style>
    <table width="226" height="140" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid gray;"><tr style="background-color:DDDDDD;"><td bgcolor="#0099FF" style="padding: 4px 0;">  <div align="center"><span class="style2" style="font:bold 16px Arial;">Login!</span>
      </div></td>
    </tr>
    </td>
      <div align="center"></div>
    
    <form name="loginstuff" method="post" action="login.php?_=dologin">
      <tr style="background-color:FFFFFF;">
        <td style="padding:4px 6px; text-align:center;"><div align="center">Username:
          <input type="text" name="username" id="username">  
        </div>    </tr>
      <tr style="background-color:FFFFFF;">
        <td style="padding:4px 6px; text-align:center;"><div align="center">Password:
          <input type="password" name="password" id="password">  
          </div>
        <tr style="background-color:FFFFFF;">
      <td style="padding:4px 6px; text-align:center;">
          <label>
          <div align="center">
            <input type="submit" name="button" id="button" value="Login!">
          </div>
          </label>
          <label>      </label>
      </form>
      </td>
        <div align="center"></div>
      <td height="2"><div align="center"><br>
            <small>Copyright YourSiteName</small></div>  </tr></table>
    ^^ The perfect loginform ;p

  3. #3
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Has to be php, then javascript.. I've tried it before rofl.

  4. #4
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    You can do the prompts, but you need to set a variable for those input, then do an AJAX request.

  5. #5
    Join Date
    Feb 2007
    Location
    Essex, England
    Posts
    1,392
    Tokens
    0

    Latest Awards:

    Default

    lol, not sure i understand, but +rep all.

    ty!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •