hai everyone..i have run this file in my server.the following error is display

Notice: Undefined index: name in F:\wamp\www\examples1\register.php on line 8

Notice: Undefined index: username in F:\wamp\www\examples1\register.php on line 9

Notice: Undefined index: emailid in F:\wamp\www\examples1\register.php on line 10

Notice: Undefined index: password in F:\wamp\www\examples1\register.php on line 11

Notice: Undefined index: cpassword in F:\wamp\www\examples1\register.php on line 12
Anyone help me..

$host ='localhost';
$user ='root';
$password ='';
$database ='dta';
$conn = mysql_connect($host,$user,$password)or die ('server is not connect');
$name = mysql_real_escape_string($_POST['name']);
$username = mysql_real_escape_string($_POST['username']);
$emailid = mysql_real_escape_string($_POST['emailid']);
$password = mysql_real_escape_string($_POST['password']);
$cpassword = mysql_real_escape_string($_POST['cpassword']);
$query = " insert into users(name,username,emaiid,password,)values ('$name','$username','$emailid','$password')";
$res = mysql_query($query);
<title> registeration form</title>
<form id= "register form" name="register form" method="post" action="">
  <table width="300" border="0" align="center" cellpadding="2" cellspacing="0">
      <th> name </th>
      <td><input name="name" type="text" class="textfield" id="name" /></td>
      <th>user name </th>
      <td><input name="username" type="text" class="textfield" id="user name" /></td>
      <th width="124">email id</th>
      <td width="168"><input name="emailid" type="text" class="textfield" id="email id" /></td>
      <td><input name="password" type="password" class="textfield" id="password" /></td>
      <th>Confirm Password </th>
      <td><input name="cpassword" type="password" class="textfield" id="cpassword" /></td>
      <td> </td>
      <td><input type="submit" name="submit" value="Create account" /></td>

A $_POST variable may not have a value, so you should do the following:

$name = isset($_POST['name']) ? mysql_real_escape_string($_POST['name']) : '';

or move the assignments within the if.

Add on: Your query is incorrect, check that you have the syntax right.

hai.thanks.nw script is working.but i am new beginner for php developer.y used for this ?something :'';
pls tell me

hai.thanks.nw script is working.but i am new beginner for php developer.y used for this ?something :' ';
pls tell me

It's called the ternary operator, a shorthand if/else construct. See the manual, example #2.

suppose i fill the form and click the submit button.the pages not go to next page.but i includer the header funtion.header('location:register_success.php');

Did you fix your query, as I mentioned earlier ?

$query = " insert into users(name,username,emailid,password,)values ('$name','$username','$emailid','$password')";
i think query is correct

my table name is users. my table is create table users(id int(11) auto increment,name varchar(100),username varchar(100),email id varchar (100), password varchar(100), primary key(id));

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.