Page 3 of 3

Re: how to use session()

Posted: Mon Mar 09, 2009 10:42 am
by nishmgopal
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /disks/diskh/zco/conmg/public_html/go.php on line 12

Re: how to use session()

Posted: Mon Mar 09, 2009 10:49 am
by susrisha
dont know how but i got it sorted with my editor

Code: Select all

 
session_start();
if(isset($_POST['job']))
 {
 echo "post value assigned to job is ".$_POST['job'];
 
 
  $_SESSION['job']=$_POST['job'];
 
  echo "SESSION VALUE ASSIGNED is ".$_SESSION['job'];
  }
  else
  {
  echo "POST VALUE NOT ASSIGNED TO JOB";
 }
 

Re: how to use session()

Posted: Mon Mar 09, 2009 10:54 am
by nishmgopal
Right that worked now. And I got the following output:

POST VALUE NOT ASSIGNED TO JOB

and the code you gave me to put on page2 is returning the below error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /disks/diskh/zco/conmg/public_html/find10a.php on line 65

The Code I have for page2 is:

Code: Select all

 
<?php
 
 session_start();
 if(!isset($_SESSION['job']))
 {
 echo "job value is not set";
 }
 else
 {
 echo "JOB Value is set to $_SESSION['job']";
 }
 ?>
 
 
 
 

Re: how to use session()

Posted: Mon Mar 09, 2009 10:56 am
by susrisha

Code: Select all

 
//page2 code
 session_start();
 if(!isset($_SESSION['job']))
 {
 echo "job value is not set";
 }
 else
 {
 echo "JOB Value is set to". $_SESSION['job'];
 }
 
And in the form that you want to send the data.. i think in page1.php

Code: Select all

 
 
<form action="go.php" method="post">
 

Re: how to use session()

Posted: Mon Mar 09, 2009 11:04 am
by nishmgopal
Thank you so much! It finnaly works!!

I cannot thank you enough, I have been struggling with this for far to long.

:)