how can i remove this error

E:\wamp\www\jobsite\index.php on line 4

Page 1 of 1

4 Replies - 569 Views - Last Post: 31 March 2010 - 09:49 PM Rate Topic: -----

#1 mahfuzwit  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 30-March 10

how can i remove this error

Posted 31 March 2010 - 01:58 AM

hi,

I am new in php. please help me. How can i remove this error. The error is:

Undefined index: name in E:\wamp\www\jobsite\index.php on line 4

Undefined index: user in E:\wamp\www\jobsite\index.php on line 6

Undefined index: password in E:\wamp\www\jobsite\index.php on line 7

My code is
<?php
        session_start();
        include "connection.php";
        if($_SESSION['name']=='')
        {
                $uname = $_POST['user'];
                $pass = $_POST['password'];
                if(!empty($uname)){
                        $sql = "SELECT * FROM login WHERE username = '$uname' AND password = '".md5($pass)."'";
                        $rs = mysql_query($sql);
                        if($rs && mysql_num_rows($rs) > 0)
                        {
                                $_SESSION['name'] = $uname;
                                echo "<script> location.replace('logout.php')</script>";
                        }
                        else
                                echo "<script> alert('Wrong Username or Password'); </script>";
                }
        }
        else
                echo "<script> location.replace('logout.php')</script>";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>www.ejobs.com</title>
</head>

<body>
        <div>Login<br/><br/>
                <form action="" method="post">
                        Username: <input type="text" name="user" /><br /><br />
                        Password: <input type="password" name="password" /><br /><br />
                        <a style="color: rgb(83, 116, 242);" class="arial10px" target="_blank" href="forget.php">Forgot password?</a>
                        <input type="submit" value="Login"><br/><br/>
                        <a style="color: rgb(83, 116, 242);" class="arial10px" target="_blank" href="ragistation1.php">Create New Account</a>
                </form>
        </div>

</body>
</html>



Please help me

Thanks
Mahfuz

This post has been edited by JackOfAllTrades: 31 March 2010 - 04:59 AM
Reason for edit:: Added code tags. Please [code]...PUT YOUR CODE IN HERE!!!...[/code]


Is This A Good Question/Topic? 0
  • +

Replies To: how can i remove this error

#2 aklo  Icon User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 229
  • Joined: 23-January 09

Re: how can i remove this error

Posted 31 March 2010 - 02:59 AM

I'm new so pardon me if it doesn't work.

The first error i notice is the

<form action="" method="post">

You didn't specify what you want the form to do? If you are trying to send to the same page you can use

<form action=$_SERVER['PHP_SELF'] method="post">


I'm not sure if this will solve your problem but i'm pretty sure you must specify some url at "<form action"

This post has been edited by aklo: 31 March 2010 - 03:02 AM

Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6064
  • View blog
  • Posts: 23,519
  • Joined: 23-August 08

Re: how can i remove this error

Posted 31 March 2010 - 05:00 AM

You already asked this question here, where I also ANSWERED it!
Was This Post Helpful? 0
  • +
  • -

#4 mahfuzwit  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 30-March 10

Re: how can i remove this error

Posted 31 March 2010 - 09:42 PM

thanks for ur solution but in this process i can't solve it.
Was This Post Helpful? 0
  • +
  • -

#5 no2pencil  Icon User is online

  • Admiral Fancy Pants
  • member icon

Reputation: 5319
  • View blog
  • Posts: 27,223
  • Joined: 10-May 07

Re: how can i remove this error

Posted 31 March 2010 - 09:49 PM

This is a duplicate topic, Please reply to the original.

** Closed **
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1