Home » Open Source » Programming Interfaces » session variable not working in php (PHP(5.6), oracle 11g R2 11,0.2)
icon5.gif  session variable not working in php [message #663304] Mon, 29 May 2017 08:26 Go to next message
Messages: 94
Registered: May 2017
I have a form like this: The file name is "main.php"
		<form action = "options.php" method = "POST" />
			<p> <h3> Enter Phone Number: </h3> <input type = "text" name = "cust_phone" />
			<p> <input type = "submit" value = "Submit" />
The "options.php" looks like this:
	<body> Details of: <?php session_start();
		echo htmlentities($_POST["cust_phone"]) . "<br>";
		$link = oci_connect('hd','hd', 'localhost/mydb');
		if(!$link) {
			$e = oci_error();
			exit('Connection error	' . $e['message']);
		$_SESSION['var'] = $_POST["cust_phone"];
		echo $_SESSION['var'];
		$ph = htmlentities($_POST["cust_phone"]);
		$q1 = "select CUST_ID from customer where CUST_PHONE = :bv_ph";
		$q1parse = oci_parse($link, $q1);
		oci_bind_by_name($q1parse, ':bv_ph', $ph);
		$res = oci_result($q1parse, 'CUST_ID');
		if(!$res) {
			echo "No Order found. New Order?";
		<form action = "" method = "POST" >
			<input type = "radio" name = "option" value = "Yes" checked> Yes <br>
			<input type = "radio" name = "option" value ="No"> No <br>
			<input type = "submit" value = "submit">
			if(isset($_POST['option']) && ($_POST['option']) == "Yes") {
					header("Location: newcustomer.php");
			elseif(isset($_POST['option']) && ($_POST['option']) == "No") {
				header("location: main.php");
The "newcustomer.php" looks like this:
		<form action = "order.php" method = "POST" >
		<p> Phone Number: </p>
		<p> Enter Address: <input type = "text" name = "address" /></p>
		<p> Enter Area: <input type = "text" name = "area" /></p>
			 echo $_SESSION ['var'];
I want the value of the number entered by the user in "main.php" to be used in "newcustomer.php" which I am not able to achieve. Am i using the session variable correctly? The result when I run "newcustomer.php" does not show any error but does not echo the "$_SESSION['var']".

[Updated on: Mon, 29 May 2017 08:28]

Report message to a moderator

Re: session variable not working in php [message #663305 is a reply to message #663304] Mon, 29 May 2017 09:45 Go to previous message
Messages: 25751
Registered: January 2009
Location: SoCal
Senior Member
Problem & solution have NOTHING to do with Oracle

post this issue to other forum like from below


This topic is now locked.
PM me if you disagree
Previous Topic: Displaying Information based on entered value in PHP with Oracle Database 11g R2
Next Topic: Attempted to call function "oci_connect"
Goto Forum:

Current Time: Sun Dec 17 06:21:46 CST 2017

Total time taken to generate the page: 0.01414 seconds