hello guys
i hav db as to store firstname,lastname,email,addr,city.
if i select any id i want that particular row and also at that same page i click next button next row want to preview.
please help for this by send code as possible soon

Hi gdsm.., Here i post you a sample code.. Just replace your table name and place you displaying format in specified area here, you will get it as your wish.. It will works better., If any probs, pls let me know...

<?php
$id=$_POST['id']               
@$option=$_POST['submit1'];    // This is for your select option.. Previous or Next...
if(isset($option))
{
$i=0;
$sql1=mysql_query("select * from table_name");
while($ret=mysql_fetch_array($sql1))
{
if($i==0)
{
$startid=$ret['id'];    // This will get the starting id in your database....
$i++;
}
else
{
$endid=$ret['id'];    // This will get all id's but it will overwrites upto the last... So, we can get last id of your database by this...
}
}
if($option=='Previous')
{
if($id==$startid)   // if starting id number...
{
echo "Sorry.. No previous records...";
exit;
}
else
{
$id=$id-1;
}
}

if($option=='Next')
{
if($id==$endid)
{
echo "Sorry.. No Next records found..";
exit;
}
else
{
$id=$id+1;
}
}
}

echo "<form action='' name='myform' method='post'>";

$sql=mysql_query("select * from table_name where id='$id'");
if(!sql)
{
echo "Sorry... Records not found.. This may be deleted...";
exit;
}

while($ret=mysql_fetch_array($sql))
{
// Your records displaying code.... It is better to display in a table format...
}
echo "<input type='submit' value='Previous' name='submit1'> &nbsp;&nbsp;&nbsp; <input type='submit' value='Next' name='submit1'>";
?>
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.