Click to See Complete Forum and Search --> : [RESOLVED] edit form...


fibonacci
05-08-2006, 04:51 AM
heyya..
can anyone help me here..
i got a problem with my edit form

my code as follow:<?
require 'f:/www/digitallibrary/conf/config.inc.php';
require 'f:/www/digitallibrary/conf/smarty.inc.php';
chdir('../../');
?>
<?php

$query = "select * from dil_logins WHERE userID='".$_GET['userID']."'";

$result = mysql_query($query);


if (!$result)
{
die('DIEEEEEEEE'.mysql_error());
}

echo "HEY : ".$query;

$row = mysql_fetch_array($result);

$userID=$row["userID"];
$username=$row["username"];
$password=$row["password"];




?>

<html>
<head>
<title>student form</title>
</head>
<body>

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

<fieldset style="width: 320; height: 240; padding: 2">


<p><b>Username: </b>
Username&nbsp;<input type="text" name="userID" readonly size="20" maxlength="40" value='<?php echo $userID;?>'></p>

<p><b>First Name: </b>
First_Name&nbsp;<input type="text" name="username" size="20" maxlength="40" value='<?php echo $username;?>' ></p>

<p><b>Last Name: </b>
Second_Name&nbsp;<input type="text" name="password" size="20" maxlength="40" value='<?php echo $password;?>'></p>

<input type ="submit" value="Edit "></form>
</fieldset>
</body>
</html>


<?php

if (isset($_POST["userID"]))
{

//$query = "select * from STUDENT WHERE email='$email'";
//$result = mysql_query($query);




$query_insert = "update dil_logins set username='".$_POST['username']."',password='".$_POST['password']."' where userID='".$_POST['UserID']."'";
echo "HEY 2 :".$query_insert;

$execute_query = mysql_query($query_insert);

if (!$execute_query)
{
die('DIEEEEEEEE'.mysql_error());
}
else
{
echo "Succeessful insert";
}

}


?>

<p>
<a href ="menu.html">Back</a></p>


the error apear to be like this;
Notice: Undefined index: userID in F:\WWW\digitallibrary\htdocs\login\edit_form.php on line 8

i have no idea where should i define the username..
please help me out...
thanks in advanced

laserlight
05-08-2006, 05:27 AM
Looks like a PHP error to me.

pppppp
05-08-2006, 05:59 AM
<?php

$query = "select * from dil_logins WHERE userID='".$_GET['userID']."'";

$result = mysql_query($query);


if (!$result)
{
die('DIEEEEEEEE'.mysql_error());
}

echo "HEY : ".$query;

$row = mysql_fetch_array($result);

$userID=$row["userID"];
$username=$row["username"];
$password=$row["password"];




?>


y have u used this at the start of ur form... are u passing the userid thru the get method???