Jump to content

[SOLVED] Notice: Undefined variable: errorstring in h:\Project\HTDOCS\new patient databas


patelp7

Recommended Posts

im doing a project for college...and keep getting this error.

 

Please help!

 

Notice: Undefined variable: errorstring in h:\Project\HTDOCS\new patient database\AddUser1.php on line 60

 

if (mysql_errno()<>0) {

$error =1;

$errorstring = mysql_error() . "\n";

}

}else{

$error=1;

}

if(($Userlen<6) || ($Userlen>15)){

$errorstring.="<BR>Your username was $Userlen characters long it must be between 6 and 15 characters long.<BR>";

}

if (($Passlen<5) || ($Passlen>15)){

$errorstring.="<BR>your password was $Passlen characters long it must be between 5 and 15 characters long<BR>";

}

 

}

if ($error<>0){

DisplayAddForm($errorstring);

}else{

$Username=$_session['Username'];

//$Userlevel= $_session['Userlevel'];

Displaymenu($Username, "User successfully added");

}

}else{

DisplayAddForm($errorstring);

}

<?

session_start();

require("db.php.inc");

require ("addfunc.inc");

 

if (isset($_POST['SUBMIT']) ){

extract($_POST);

$error=1;

 

//check to see variables are set

if ( (isset($Username)) && (isset($Password)) ) {

 

 

//set error flag to 0

$error=0;

 

 

//Remove leading and trailing white spaces in input

$Username=trim($Username);

$Password=trim($Password);

 

 

//check to see if username and password contain sufficient characters

$Userlen = strlen($Username);

$Passlen = strlen($Password);

 

 

 

if ( (($Userlen>5) && ($Userlen<20))&&(($Passlen>4)&&($Passlen<15)) ){

 

 

$Encryptedpassword = crypt($Password, "ND");

$query = "insert into adminmember (Username, Password, First_Name, Last_Name, EmailAdd, User_Level) Values ('$Username', '$Encryptedpassword', '$First_Name', '$Last_Name', '$EmailAdd', '$value')";

 

$result=mysql_query($query);

 

if (mysql_errno()<>0) {

$error =1;

$errorstring = mysql_error() . "\n";

 

}

}else{

$error=1;

}

if(($Userlen<6) || ($Userlen>15)){

$errorstring.="<BR>Your username was $Userlen characters long it must be between 6 and 15 characters long.<BR>";

}

if (($Passlen<5) || ($Passlen>15)){

$errorstring.="<BR>your password was $Passlen characters long it must be between 5 and 15 characters long<BR>";

}

 

}

if ($error<>0){

DisplayAddForm($errorstring);

}else{

$Username=$_session['Username'];

//$Userlevel= $_session['Userlevel'];

Displaymenu($Username, "User successfully added");

}

}else{

DisplayAddForm($errorstring);

}

 

?>

 

the BOLD code

 

 

 

<?

function DisplayAddForm ($errorstring) {

print ('

<html>

<head>Registration Details</head>

<body>

<H3>Add Admin</H3>

<P>Please enter your username and password</p>');

echo $errorstring;

print('

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

<br>

<b>Username :</b><input type=text name="Username"><br><br>

<b>Password :</b><input type=password name ="Password"><BR><br>

<b>First Name :</b><input type=text name ="First_Name"><BR><br>

<b>Last Name :</b><input type=text name ="Last_Name"><BR><br>

<b>Email Address :</b><input type=text name ="EmailAdd"><BR><br>

<b>Administrator </b><input type =radio name = userlevel value=1> <BR><BR>

<Input type =SUBMIT name ="SUBMIT" value="SUBMIT">

<Input type = Reset>

</form>

</body>

</html>

');

 

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.