...

View Full Version : Login Page.



gator
05-14-2007, 02:45 AM
I made a forum and I need help with the login page. I have This so far

<?
require('config.php');
?>

<?php include('header.php'); ?>

<h2>User Login</h2>

<form method="post" action="logon_user.php">

<table>
<tr><td>Username:</td><td><input name="username" type="text" /></td></tr>
<tr><td>Password:</td><td><input name="password" type="password" /></td></tr>
</table>

<input type="submit" name="Submit" value="Submit" class="button"/> <input type="reset" name="Submit2" value="Reset" class="button"/>



</form>


<?php include('footer.php'); ?>


Im trying to add a javascript code to verify that the user name and password has been entered...Can someone help me with this? Im not sure what the code would be or where to put it...All help would be appreciated.

Philip M
05-14-2007, 08:24 AM
<form name = "myform" method="post" action="logon_user.php" onsubmit = "return validate(this.Submitbutton)">

<table>
<tr><td>Username:</td><td><input name="username" type="text" /></td></tr>
<tr><td>Password:</td><td><input name="password" type="password" /></td></tr>
</table>

<input type="submit" name="Submitbutton" value="Submit" class="button" /> <input type="reset" name="Submit2" value="Reset" class="button"/>

<SCRIPT type = Text/JavaScript"
function validate() {
if ((document.myform.username.value.length <5) || (document.myform.password.value.length <5)) { //minimum 5 characters
alert ("You must complete the user name and password fields");
return false;
}
else {return true}
}
</SCRIPT>

gator
05-14-2007, 01:16 PM
I updated it useing this:

<?
require('config.php');
?>

<?php include('header.php'); ?>

<h2>User Login</h2>

<form name = "myform" method="post" action="logon_user.php" onsubmit = "return validate(this.Submitbutton)">

<table>
<tr><td>Username:</td><td><input name="username" type="text" /></td></tr>
<tr><td>Password:</td><td><input name="password" type="password" /></td></tr>
</table>

<input type="submit" name="Submitbutton" value="Submit" class="button" /> <input type="reset" name="Submit2" value="Reset" class="button"/>

<SCRIPT type = Text/JavaScript"
function validate() {
if ((document.myform.username.value.length <5) || (document.myform.password.value.length <5)) { //minimum 5 characters
alert ("You must complete the user name and password fields");
return false;
}
else {return true}
}
</SCRIPT>


<?php include('footer.php'); ?>


Doesn't seem to work though...

Nischumacher
05-14-2007, 01:22 PM
i DoN'T KNoW MuCH aBouT PHP... BuT iT SeeMS You aRe MiSSiNG THe FoRM CLoSiNG TaG... </form>...

rwedge
05-14-2007, 03:33 PM
<SCRIPT type = Text/JavaScript"should be
<script type="text/javascript">

Philip M
05-14-2007, 05:14 PM
<SCRIPT type = Text/JavaScript"should be
<script type="text/javascript">


HTML (unlike Javascript) is not case sensitive, but the missing " is indeed important! Thanks for spotting this!

gator
05-14-2007, 11:01 PM
Thanks guys:) This is a great forum. Im going to stick around if thats ok:)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum