another, another page by POST method

General discussion on PHP
Post Reply
tklinn
Posts: 17
Joined: Mon Mar 30, 2009 8:30 am
Location: Singapore

another, another page by POST method

Post by tklinn » Tue Mar 31, 2009 10:28 am

Hi All,

how to carry the data to another, another page by POST method.Here i use session to pass the var.

1 without using hidden field
2.without array

can i save all POST var as in somewhere?

Code: Select all

<?
include 'db_config.php';
include 'db_open.php';
extract($_POST);
extract($_SESSION);
foreach ($_SESSION as $key => $value) {

                                    $temp = is_array($value) ? $value : trim($value);
                                    ${$key} = mysql_real_escape_string($temp);

                                    }

		$sql = "INSERT INTO CLIENT (CUSTID,TITLE,NAME_EN,NAME_EX,NAME_LAST,DOB,TYPE,SVCBY,CTYPE,LOG_CREATEBY,LOG_CREATEDATE,LOG_EDITBY,LOG_EDITDATE,FUNC_DELETED) 
				VALUES ('$num3','$TITLE','$NAME_EN','$NAME_EX','$NAME_LAST','$DOB','$TYPE','$a','$CTYPE','".$_SESSION[ADMIN_NAME]."','$LOG_CREATEDATE','$LOG_EDITBY','$LOG_EDITDATE','0')";
		$result = mysql_query($sql);
print "<script language=\"javascript\"> alert('The record has been updated successfully.'); </script>";

?>
Thanks & Best Regards,
Thet Kyaw Linn

dzysyak
Posts: 9
Joined: Tue Mar 24, 2009 1:37 am
Location: Ukraine
Contact:

Re: another, another page by POST method

Post by dzysyak » Tue Mar 31, 2009 8:59 pm

First of all I suggest do not extract $_POST and $_SESSION, because they can override each other. So, you can save posted vars like

Code: Select all

$_SESSION['post'] = $_POST;

Post Reply