-
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 ;).
-
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
-
Has to be php, then javascript.. I've tried it before rofl.
-
You can do the prompts, but you need to set a variable for those input, then do an AJAX request.
-
lol, not sure i understand, but +rep all.
ty!