Hi guys,
Could anyone help me out with this...
I have a multi form, which the user enter in the data and submits the data.. It also have a save button in it.. so user can save and then come back,.. then can save again, or submit..
I saved the data to a table in db.. when the user comes again...the data has to be reloaded in the textfield, that is retrieve...
so i used...
<input type="text" name="aa" value="<?php echo "$ss_address"; ?>" />
which is retrieve the data from database..
since it is a multi form,
when i change the data in the text field, and go to next page and come back.. the data doesnt change... its still the old data which is retrieved from the db..
I know., it something with passing session..
Can someone help me out..
I have posted the codes below:
pg1.php
<?php
session_start();
?>
<?php
include "base.php";
?>
<!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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$txt_name = $_SESSION['txt_name'];
echo "$txt_name";
$query = "SELECT p_id,id,company_country,Project_title,total_grant,partner_company,end_date,c_name FROM create_project where c_name ='$txt_name'";
$result = mysql_query($query);
if($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$p_id = $row['p_id'];
$id = $row['id'];
echo "Project ID: $p_id";
echo "<br>";
echo "Company ID: $id";
echo "<br>";
}
?>
<?php
$saved_query = "SELECT * FROM creator_save WHERE p_id ='$p_id' AND id = '$id' AND status = 'saved'";
$saved_result = mysql_query($saved_query);
while($saved_row = mysql_fetch_array($saved_result))
{
$ss_address = $saved_row['creator_address'];
$ss_name = $saved_row['tm_name'];
//$_SESSION['address'] = $ss_address;
//echo"$ss_address";
}
?>
<form id="form1" name="form1" method="post" action="">
<label>
a:
<input type="text" name="aa" value="<?php echo "$ss_address"; ?>" />
</label>
<p>
B:
<input type="text" name="bb" value="<?php echo "$ss_name"; ?>" />
</p>
<p><a href="pg2.php">PG2 > </a></p>
</form>
</body>
</html>
pg2.php
<?php
session_start();
?>
<?php include "base.php"; ?>
<?php
//if (!isset($_SESSION['address']) || isset($_POST['a'])) {
// $_SESSION['address'] = $_POST['aa'];
//$add = $_SESSION['address'];
//}
?>
<!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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$txt_name = $_SESSION['txt_name'];
echo "$txt_name";
//echo "$add";
$query = "SELECT p_id,id,company_country,Project_title,total_grant,partner_company,end_date,c_name FROM create_project where c_name ='$txt_name'";
$result = mysql_query($query);
if($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$p_id = $row['p_id'];
$id = $row['id'];
echo "Project ID: $p_id";
echo "<br>";
echo "Company ID: $id";
echo "<br>";
}
?>
<?php
$saved_query = "SELECT * FROM creator_save WHERE p_id ='$p_id' AND id = '$id' AND status = 'saved'";
$saved_result = mysql_query($saved_query);
while($saved_row = mysql_fetch_array($saved_result))
{
$ss_design = $saved_row['tm_design'];
$ss_email = $saved_row['tm_email'];
//$_SESSION['address'] = $ss_address;
//echo"$ss_address";
}
?>
<form id="form1" name="form1" method="post" action="">
<label>
c:
<input type="text" name="c" id="c" value="<?php echo "$ss_design"; ?>" />
</label>
<p>
D:
<input type="text" name="d" id="d" value="<?php echo "$ss_email"; ?>"/>
</p>
<p><a href="pg1.php">< PG1</a></p>
</form>
</body>
</html>
Thanks for ur help..
:)
Tryphy