Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problems with Accessing Variables from different pages

    Hie

    could some1 please help me, I am trying to show the user of my website the information they have entered into my database just after he/she has submitted the information. I am trying to do this by assigning the information they have entered to variables. I have tried the following and its noty working

    PAGE1

    $contactname = clean( $_POST['contact_name']);
    $_SESSION['$contact_name']= $contactname;

    PAGE2

    <?php session_start(); ?>

    <tr><td>Client name
    <td><?php $_SESSION['contact_name']; ?></td

    page 1 is suppossed to lead to page 2 and display something for the $_SESSION['contact_name'] variable but no text is showing.

    could some1 please help me

    Thank you

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Is session_start() at the top of page 1? session_start() needs to be at the top of every page that you want to use sessions on. And this
    PHP Code:
    $_SESSION['$contact_name']= $contactname
    should be this
    PHP Code:
    $_SESSION['contact_name']= $contactname
    This also won't work
    PHP Code:
    <?php $_SESSION['contact_name']; ?>
    You need to either echo the $_SESSION or do something like this
    PHP Code:
    <?=$_SESSION['contact_name']?>
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •