i always get some problem when i try to create a edit link and corresponding page.

now the value to be edited are not shown in the edit form, and i do want to return to the same page where i have selected value to editted .can any one help me please

Hi.

Invisible code is extremely hard to debug.

Please show us the parts of your code that are causing the problem.
(Note, not all of the code, just the parts that aren't working)

Hi.

Invisible code is extremely hard to debug.

Please show us the parts of your code that are causing the problem.
(Note, not all of the code, just the parts that aren't working)

<?php
include("connectivity.php");
$category=$_REQUEST['category'];
$description=$_REQUEST['description'];
$parentid=$_REQUEST['parentid'];
$path=$_REQUEST['path'];
$catid=$_REQUEST['catid'];
mysql_query("update category set vcategory='$category',vdescription='$description' where icatid=$catid");
header("location:view.php?parentid=$parentid&path=$path");
?>

hope it will help you to solve my problem

Where is view.php? whether it is in a same folder or another.

Where is view.php? whether it is in a same folder or another.

ya its in same folder should paste that code too

Dude, your code is OK. Is there any error message?

Dude, your code is OK. Is there any error message?

no ya its just don't shows the value i have checked with db also and its ok
is there any thing wrong with this

echo "<td><a href=\"edit.php?parentid=$obj->iparentid&catid=$obj->icatid&path=$obj->tPath\">Edit</a></td>";

Technically no, but you should really enclose object members in brackets when you use them in strings, if only to make it easier to read the code:

echo "<td><a href=\"edit.php?parentid={$obj->iparentid}&catid={$obj->icatid}&path={$obj->tPath}\">Edit</a></td>";

(Also note how I used the tags here to display that in a nicely formatted code box)[/i]

Anyways, these bits and pieces of code are doing no good.

Ignore what I said earlier, just past the entire files here. The [I]edit.php[/I] and the [I]view.php[/I] files, as well as anything else that might be useful.

Within &#91;code=php] .. &#91;/code] tags, please.[code=php] tags here to display that in a nicely formatted code box)

Anyways, these bits and pieces of code are doing no good.

Ignore what I said earlier, just past the entire files here.
The edit.php and the view.php files, as well as anything else that might be useful.

Within &#91;code=php] .. &#91;/code] tags, please.

Technically no, but you should really enclose object members in brackets when you use them in strings, if only to make it easier to read the code:

echo "<td><a href=\"edit.php?parentid={$obj->iparentid}&catid={$obj->icatid}&path={$obj->tPath}\">Edit</a></td>";

(Also note how I used the

tags here to display that in a nicely formatted code box)[/i]

Anyways, these bits and pieces of code are doing no good.

Ignore what I said earlier, just past the entire files here.
The [I]edit.php[/I] and the [I]view.php[/I] files, as well as anything else that might be useful.

Within [code=php] ..

tags, please.

thank you for the information. i will post the code

VIEW.PHP

<?php 
include("connectivity.php");
$parentid=$_REQUEST['parentid'];
$path=$_REQUEST['path'];
if(!$path)
{
 $path=0;
}
if(!$parentid)
{
$parentid=0;
}
$a=$_REQUEST['a'];
if(!$a)
{
$a=0;
}
$qry=mysql_query("select * from category where iparentid='$parentid' limit $a,4");
$qrynum=mysql_query("select * from category where iparentid='$parentid'");
$num=mysql_num_rows($qrynum);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>view</title>
</head>
<body>
<h2 align="center">category</h2>

<table align="center" border="3"/>
<tr><td colspan="4" align="left">
<?php
$new=explode("-","$path");
$num=count($new);
if($path!=0)
{
for($i=0;$i<$num;$i++)
{
   $qrycat=mysql_query("select * from category where icatid=$new[$i]");
   $objcat=mysql_fetch_object($qrycat);
   $category=$objcat->vcategory;
   if($i<$num-1)
   {
    echo "<a href=\"view.php?parentid=$objcat->icatid&path=$objcat->tPath\">$category</a> ->";
   }
   else
   {
     echo "<a href=\"view.php?parentid=$objcat->icatid&path=$objcat->tPath\">$category</a>";
   }

}
}

/*if($path!=0)
{
foreach($new as $catid)
{
   $qrycat=mysql_query("select * from category where icatid=$catid");
   $objcat=mysql_fetch_object($qrycat);
   $category=$objcat->vcategory;
   if($catid<$catid-1)
   {
   echo "<a href=\"view.php?parentid=$objcat->icatid&path=$objcat->tPath\">$category</a> ->  ";

}
else 
{
echo "<a href=\"view.php?parentid=$objcat->icatid&path=$objcat->tPath\">$category</a>   ";

}
}
}*/

?>
</td></tr>
<tr><td colspan="4" align="right"><a href="add.php?parentid=<?php echo $parentid; ?>&path=<?php echo $path; ?>">Add</a></td></tr>
<tr><td>sl.no</td><td>category</td><td>description</td><td>Options</td></tr>
<?php
//prev code
if($a>0)
{
$a=$a-4;
echo "<a href=\"view.php?a=$a&parentid=$parentid&path=$path\">prev</a>&nbsp;&nbsp;";
$a=$a+4;
}
//prev code ends here
//page no
$div=$num/4;
$rem=$num%4;
if($rem>0)
{
$div=$div+1;

}
$b=0;
for($i=1;$i<=$div;$i++)
{
if($a==$b)
{
echo "<a href=\"view.php?a=$b&parentid=$parentid&path=$path\"><font color='red'>$i</font></a>&nbsp;&nbsp;";
}
else
{
echo "<a href=\"view.php?a=$b&parentid=$parentid&path=$path\">$i</a>&nbsp;&nbsp;";
}
$b=$b+4;
}
//
//next code starts here
$a=$a+5;
if($a<$num)
{
echo "<a href=\"view.php?a=$a&parentid=$parentid&path=$path\">Next</a>&nbsp;&nbsp;";
}
$a=$a-5;
//next code ends here
?>
<?php 
$sl=1+$a;
while($obj=mysql_fetch_object($qry))
{
echo "<tr>";

echo "<td>$sl</td>";

echo "<td><a href=\"view.php?parentid=$obj->icatid&path=$obj->tPath\">$obj->vcategory</a></td>";

echo "<td>$obj->vdescription</td>";

echo "<td><a href=\"edit.php?parentid=$obj->iparentid&catid=$obj->icatid&path=$obj->tPath\">Edit</a></td>";

echo "</tr>";

$sl++;
}
?>
</table>

</body>
</html>

[/QUOTE]
EDIT.PHP

<?php
include("connectivity.php");
$parentid=$_REQUEST['parentid'];
$path=$_REQUEST['path'];
$catid=$_REQUEST['catid'];
$qry=mysql_query("select * from category where icatid=$catid");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>edit</title>
</head>

<body>
<h2 align="center">Edit</h2>
<form name="frm" method="post" action="editaction.php"/>
<table align="center" border="4"/>
<tr><td>category</td><td><input type="text" name="category" value="<?php echo $obj->vcategory;?>"/></td></tr>
<tr><td>description</td><td><input type="text" name="description" value="<?php $obj->vdescription;?>"/></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="Enter"/>&nbsp;
<input type="reset" value="Cancel"/></td></tr>
</table>
<input type="hidden" value="<?php echo $parentid;?>"/>
<input type="hidden" value="<?php echo $path;?>"/>
<input type="hidden" value="<?php echo $catid;?>"/>
</form>
</body>
</html>

[/QUOTE]

editaction.php

<?php
include("connectivity.php");
$category=$_REQUEST['category'];
$description=$_REQUEST['description'];
$parentid=$_REQUEST['parentid'];
$path=$_REQUEST['path'];
$catid=$_REQUEST['catid'];
mysql_query("update category set vcategory='$category',vdescription='$description' where icatid=$catid");
header("location:view.php?parentid=$parentid&path=$path");
?>



hope u can understand better wat i am saying

[/quote]

Technically no, but you should really enclose object members in brackets when you use them in strings, if only to make it easier to read the code:

echo "<td><a href=\"edit.php?parentid={$obj->iparentid}&catid={$obj->icatid}&path={$obj->tPath}\">Edit</a></td>";

(Also note how I used the

tags here to display that in a nicely formatted code box)[/i]

Anyways, these bits and pieces of code are doing no good.

Ignore what I said earlier, just past the entire files here.
The [I]edit.php[/I] and the [I]view.php[/I] files, as well as anything else that might be useful.

Within [code=php] ..

tags, please.

thank you for the information. i will post the code

VIEW.PHP

<?php 
include("connectivity.php");
$parentid=$_REQUEST['parentid'];
$path=$_REQUEST['path'];
if(!$path)
{
 $path=0;
}
if(!$parentid)
{
$parentid=0;
}
$a=$_REQUEST['a'];
if(!$a)
{
$a=0;
}
$qry=mysql_query("select * from category where iparentid='$parentid' limit $a,4");
$qrynum=mysql_query("select * from category where iparentid='$parentid'");
$num=mysql_num_rows($qrynum);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>view</title>
</head>
<body>
<h2 align="center">category</h2>

<table align="center" border="3"/>
<tr><td colspan="4" align="left">
<?php
$new=explode("-","$path");
$num=count($new);
if($path!=0)
{
for($i=0;$i<$num;$i++)
{
   $qrycat=mysql_query("select * from category where icatid=$new[$i]");
   $objcat=mysql_fetch_object($qrycat);
   $category=$objcat->vcategory;
   if($i<$num-1)
   {
    echo "<a href=\"view.php?parentid=$objcat->icatid&path=$objcat->tPath\">$category</a> ->";
   }
   else
   {
     echo "<a href=\"view.php?parentid=$objcat->icatid&path=$objcat->tPath\">$category</a>";
   }

}
}

/*if($path!=0)
{
foreach($new as $catid)
{
   $qrycat=mysql_query("select * from category where icatid=$catid");
   $objcat=mysql_fetch_object($qrycat);
   $category=$objcat->vcategory;
   if($catid<$catid-1)
   {
   echo "<a href=\"view.php?parentid=$objcat->icatid&path=$objcat->tPath\">$category</a> ->  ";

}
else 
{
echo "<a href=\"view.php?parentid=$objcat->icatid&path=$objcat->tPath\">$category</a>   ";

}
}
}*/

?>
</td></tr>
<tr><td colspan="4" align="right"><a href="add.php?parentid=<?php echo $parentid; ?>&path=<?php echo $path; ?>">Add</a></td></tr>
<tr><td>sl.no</td><td>category</td><td>description</td><td>Options</td></tr>
<?php
//prev code
if($a>0)
{
$a=$a-4;
echo "<a href=\"view.php?a=$a&parentid=$parentid&path=$path\">prev</a>&nbsp;&nbsp;";
$a=$a+4;
}
//prev code ends here
//page no
$div=$num/4;
$rem=$num%4;
if($rem>0)
{
$div=$div+1;

}
$b=0;
for($i=1;$i<=$div;$i++)
{
if($a==$b)
{
echo "<a href=\"view.php?a=$b&parentid=$parentid&path=$path\"><font color='red'>$i</font></a>&nbsp;&nbsp;";
}
else
{
echo "<a href=\"view.php?a=$b&parentid=$parentid&path=$path\">$i</a>&nbsp;&nbsp;";
}
$b=$b+4;
}
//
//next code starts here
$a=$a+5;
if($a<$num)
{
echo "<a href=\"view.php?a=$a&parentid=$parentid&path=$path\">Next</a>&nbsp;&nbsp;";
}
$a=$a-5;
//next code ends here
?>
<?php 
$sl=1+$a;
while($obj=mysql_fetch_object($qry))
{
echo "<tr>";

echo "<td>$sl</td>";

echo "<td><a href=\"view.php?parentid=$obj->icatid&path=$obj->tPath\">$obj->vcategory</a></td>";

echo "<td>$obj->vdescription</td>";

echo "<td><a href=\"edit.php?parentid=$obj->iparentid&catid=$obj->icatid&path=$obj->tPath\">Edit</a></td>";

echo "</tr>";

$sl++;
}
?>
</table>

</body>
</html>

[/QUOTE]
EDIT.PHP

<?php
include("connectivity.php");
$parentid=$_REQUEST['parentid'];
$path=$_REQUEST['path'];
$catid=$_REQUEST['catid'];
$qry=mysql_query("select * from category where icatid=$catid");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>edit</title>
</head>

<body>
<h2 align="center">Edit</h2>
<form name="frm" method="post" action="editaction.php"/>
<table align="center" border="4"/>
<tr><td>category</td><td><input type="text" name="category" value="<?php echo $obj->vcategory;?>"/></td></tr>
<tr><td>description</td><td><input type="text" name="description" value="<?php $obj->vdescription;?>"/></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="Enter"/>&nbsp;
<input type="reset" value="Cancel"/></td></tr>
</table>
<input type="hidden" value="<?php echo $parentid;?>"/>
<input type="hidden" value="<?php echo $path;?>"/>
<input type="hidden" value="<?php echo $catid;?>"/>
</form>
</body>
</html>

[/QUOTE]

editaction.php

<?php
include("connectivity.php");
$category=$_REQUEST['category'];
$description=$_REQUEST['description'];
$parentid=$_REQUEST['parentid'];
$path=$_REQUEST['path'];
$catid=$_REQUEST['catid'];
mysql_query("update category set vcategory='$category',vdescription='$description' where icatid=$catid");
header("location:view.php?parentid=$parentid&path=$path");
?>

[/quote]
hope u can understand better wat i am saying

hi Atli thank you that you took effort to solve my problem ,and it is solved now.
there was a simple error in code that i havent put code to display the description and i havent named the passing values in view.
thank you so much for your help and guidence

I'm glad you found the solution.

It seem the smallest errors always seem to give you the biggest headaches :)

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.