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);

}

Link to comment
Share on other sites

<?

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

 

Link to comment
Share on other sites

 

 

<?

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>

');

 

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.