check the coding where error - login creation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
muruganasm
Forum Newbie
Posts: 1
Joined: Sat Jul 14, 2007 9:51 am

check the coding where error - login creation

Post by muruganasm »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hi
i have write the php language code. The login form creation. The validation part is ok.. but data is not pass to one page to another page. I have used $_REQUEST and $_Post method but not working.. any body replay me..

the following codes..

THe First file is login.php. in the file having login details.. the following code s are

Code: Select all

<html>
<head>
<title>Welcome to Login page</Title>
<script language="javascript" type="text/javascript">
{
        function checking()
        {
               if ((document.log.username.value=="")||(document.log.password.value==""))
                {
                        alert("user name/password cannot be empty");
                        document.log.username.focus();
                        return false;
                }
        }
 }
</script>
</head>
<body>
<br><br><br><br><br><br><br>
<form action="welcome.php" name="log" method="post" onsubmit="return checking()">

<table border="2" align="center" cellspacing=2 cellpadding =3 bgcolor="gray">
        <tr>
                <td>User Name </td>
                <td><input type="text" id="username" name="username"></td>
        </tr>
        <tr>
                <td>Password</td>
                <td><input type="password" id="password" name="password"></td>
        </tr>
        <tr cellspam=2>
                <td > <input type="submit" name="login" value="Login">
      <input type="reset" name="reset" value="Reset"> </td>
      <td>New User <a href="reg.php">Click Here</a></td>
        </tr>
</table> </form></body></html>


The Other file welcome.php. codes are

<html>
<head>
  <title></title>
</head>
<body alink="blue" vlink="blue" link="blue">
<p align="right">
<a href="profile.php"> Edit Profile</a>
<a href="signout.php"> Sign Out</a> </p>
<B> Welcome to Your Page
</B>
<?php
  echo $_POST['username'];
   //echo $_REQUEST['username'];
?> </body> </html>

Reply me immediately if possible. any other setting coding if anybody tell

Thanks
muruganasm


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Strip the code down to the most simple, lose the table, Javascript.. everything that isn't essential for this to work. Test it from there.
User avatar
dxm
Forum Newbie
Posts: 8
Joined: Fri Jun 29, 2007 5:18 pm
Location: Wales

Post by dxm »

I'm still new to PHP myself, try adding a hidden input type into the form and name it something like submitted, then in welcome.php add:

Code: Select all

if (isset($_POST['submitted'])) {
    echo $_POST['username'];
}
Post Reply