Jump to content

Registration page


chand.sethi77
 Share

Recommended Posts

This is my registration page (html form) :

<html>	<head>		<title>Registration </title>		<link rel="stylesheet" type="text/css" href="css.css" media="all" />	</head>	<body>	<div id="header">			<h1> Welcome </h1>			<p> You can register here free of cost. It allows you to connect dynamically. </p>		</div>		<div id="navl">			<ul type="square">				<li><a href="http://www.google.com">Back</a></li>			</ul>		</div>		<div id="page">		<form action="registered.php">			<input type="text" name="firstname" /> First name <br />			<input type="text" name="lastname" /> Last name <br />			<input type="email" name="email" /> Email <br />			<input type="password" name="password" /> Password <br />			<input type="password" name="password_confirmation" /> Retype your password <br />			<input type="integer" name="age" /> Your age <br />			<input type="submit" name="submit" value="Submit" />			<input type="reset" name="reset" value="reset" />		</form>	</body></html>

And the action page, i.e registered.php is as follows:

<?php	$connect = mysql_connect ("localhost", "root", ""); 	if (!$connect) {		die ("Could not connect to mysql : " . mysql_error() );	} 		$db_select = mysql_select_db ("users", $connect) ;		if (!$db_select) {			die ("Could not select database : " .mysql_error() ); 		}	$select = mysql_query ("SELECT * FROM accounts ", $connect); 		if (!$select) {			die ("Table selection failed " .mysql_error() ); 		}?><?php 	$fname = $_POST['firstname'];	$lname = $_POST['lname'];	$pass = $_POST['password'];	$age = $_POST['age'];	$email = $_POST['email']; ?><?php$insert = "INSERT INTO accounts (						firstname, lastname, password, age, email						) VALUES (							'({$fname})', '({$lname})', '.md5({$pass})','({$age})','({$email})'							)";			if (!mysql_query($insert,$connect))  {  die('Error: ' . mysql_error());  }echo "1 record added";if (!$insert) {	die ("Server error: Access denied : " . mysql_error() ); 	}?>

And the error I am getting is :

( ! ) Notice: Undefined index: firstname in C:\wamp\www\users\registered.php on line 17Call Stack#	Time	Memory	Function	Location1	0.0017	378168	{main}( )	..\registered.php:0( ! ) Notice: Undefined index: lname in C:\wamp\www\users\registered.php on line 18Call Stack#	Time	Memory	Function	Location1	0.0017	378168	{main}( )	..\registered.php:0( ! ) Notice: Undefined index: password in C:\wamp\www\users\registered.php on line 19Call Stack#	Time	Memory	Function	Location1	0.0017	378168	{main}( )	..\registered.php:0( ! ) Notice: Undefined index: age in C:\wamp\www\users\registered.php on line 20Call Stack#	Time	Memory	Function	Location1	0.0017	378168	{main}( )	..\registered.php:0( ! ) Notice: Undefined index: email in C:\wamp\www\users\registered.php on line 21Call Stack#	Time	Memory	Function	Location1	0.0017	378168	{main}( )	..\registered.php:0

I have created "accounts" table in "users" database. That thing to be noticed is that accounts table stores only password, nothing else, neither fname nor lname nor email. nothing, just password in .md5 form. Please copy and paste all that with corrections and <!-- --> comments that what was the problem. I am trying for 9 hours Any help will be appreciated

Link to comment
Share on other sites

I have created "accounts" table in "users" database. That thing to be noticed is that accounts table stores only password, nothing else, neither fname nor lname nor email. nothing, just password in .md5 form. Please copy and paste all that with corrections and <!-- --> comments that what was the problem.
If you are not storing firstname, lastname, email and age in the accounts table, then why are you attempting to insert these values into the table?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...