You are not passing $id from the previous page. Both has the name "name1".
Cheers.
nav33n
Purple hazed!
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
print '<input type="hidden" maxlength="19" size="53" name="name1" value="'.$line[0].'" />';
This has to be
print '<input type="hidden" maxlength="19" size="53" name="id1" value="'.$line[0].'" />';
in page 1, because, in page2, ur trying to access $_POST[$id1] which never existed !
nav33n
Purple hazed!
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
Oh, btw, you cant pass the data from 1page to another without using . Try the following.
<?php //page1.php
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
$line = $_GET['id'];
$result=mysql_query("SELECT * FROM table1 where id='$line'") or die("ERROR:".mysql_error());
for ($i = 0; $i < mysql_num_rows($result); ++$i)
{
$line = mysql_fetch_row($result);
print '<form name="test" method="post" action="page2.php">';
print 'Name<input type="text" maxlength="19" size="53" name="name1" value="'.$line[0].'" />';
print '<input type="hidden" maxlength="19" size="53" name="id" value="'.$line[0].'" />';
print '<input type="Submit" name="Submit" value="Submit" />';
print '</form>';
}
?>
<?php //page2.php
$name1=$_POST['name1'];
$id1=$_POST['id'];
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
if (isset($_REQUEST['Submit']))
{
mysql_query("UPDATE table1 SET name='$name1' where id='$id1'") or die("ERROR:".mysql_error());
echo $name1;
echo $id1;
echo "THANKS FOR ENTERING UR DETAILS";
}
?>
I hope it helps.
nav33n
Purple hazed!
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356