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 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    session's in php

    hello there,
    i am a newbie and i want to know how to handle php session's.i want to know how i can assign a selected drop down menu value to a session variable.

    thanx in advance
    mansoor ahmed

  • #2
    New Coder
    Join Date
    Jan 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    this is how i have handled my sessions

    handling of sessions:
    dd1 and dd2 are two drop down boxes

    session_start();
    $stuname = trim($_POST['dd1']);
    $stuaddr = trim($_POST['dd2']);


    $_SESSION['d1'] = $stuname
    $_SESSION['d2'] = $stuaddr;


    i am using the latest php...mysql and apache



    thanx ahmed

  • #3
    New Coder
    Join Date
    Jan 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    still not working

    i followed the above way of coding and sessions is still not working...please some some one help me out...

    ahmed

  • #4
    Regular Coder
    Join Date
    May 2004
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts
    when posting code please use the [php] tags.

    i see you are missing a semi-colon.
    PHP Code:
    $_SESSION['d1'] = $stuname  <--
    $_SESSION['d2'] = $stuaddr
    maybe you just missed it in your post.

    can you echo the vars $stuname and $stuaddr after you delare them?

    what errors (if) any does you code produce?

    where are you trying to display these $_SESSION vars? maybe they exist but you are not accessing them correctly.

    keep us posted

  • #5
    New Coder
    Join Date
    Jan 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    no errors

    Quote Originally Posted by ClubCosmic
    when posting code please use the [php] tags.

    i see you are missing a semi-colon.
    PHP Code:
    $_SESSION['d1'] = $stuname  <--
    $_SESSION['d2'] = $stuaddr
    maybe you just missed it in your post.

    can you echo the vars $stuname and $stuaddr after you delare them?

    what errors (if) any does you code produce?

    where are you trying to display these $_SESSION vars? maybe they exist but you are not accessing them correctly.

    keep us posted

    hi thanx for giving me ur valuable suggestion,i am trying to access the student name and student address value in some other webpage....and the problem is it is not working.if i try to pass a value directly into the session variable like $_SESSION['d1']='hello'; this working..i am able to get 'hello' in some other page....but if it is a value from dropdown menu then it is not working....

    thanx ahmed


  •  

    Posting Permissions

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