Passing Values between Pages : $_SESSION / $_GET

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Passing Values between Pages : $_SESSION / $_GET

    Hello All,

    I am using php and mysql in my application which allows users to
    search/query a database. The database is cast and has about 32 rows per
    record. When the user fires the query, the result is in the form of a
    table that contains only the 6 important rows of the entire record.
    Also there is a provision to allow the user to see the full record set
    by clicking on the link under the 'complete profile' contained in the
    table. (as shown below). The name of this script is lookup_results.php

    Here is the result for a companies in city = 'Charlotte' / Primary key
    of the table is the name of the company.
    ------------------------------------------------------------------------
    ------------------------------------------------------------------------
    ---------------------------
    Company Name Main Contact City Website
    E-Mail Complete
    Profile
    ------------------------------------------------------------------------
    ------------------------------------------------------------------------
    ---------------------------
    PSG Pushpy Charlotte
    [url]http://www.psg.com[/url] [email]psgarcha@psg.com[/email] --Link--
    TFNA Napier Charlotte
    [url]http://www.psg.com[/url] [email]psgarcha@psg.com[/email] --Link--
    Micro Bates Charlotte
    [url]http://www.psg.com[/url] [email]psgarcha@psg.com[/email] --Link--
    CNN Garcha PS Charlotte
    [url]http://www.psg.com[/url] [email]psgarcha@psg.com[/email] --Link--
    ------------------------------------------------------------------------
    ------------------------------------------------------------------------
    ---------------------------


    To see the complete profile of the company I use
    href=\"full_profile_1.php?name=".$row['company']\0\0.
    So once we are on the full_profile_1.php, we can see all the contents
    of the record. Also we display a form where we can edit the results in
    place. The logic works like this.

    // full_profile_1.php LOGIC


    <?

    session_start();

    if (isset($_SESSION['validuser']))
    {

    if($submit)
    {
    update the changes that the user has made to the form


    My question here is " How do I get the name of the company
    that was passed to this script as a $_GET Parameter. I cannot use the
    $company because it is out of scope. The only other option
    would be to use $_SESSION['link'] .... i.e. Store the names of the
    companies in a session array. So now the array as per the
    example above would be {'PSG','TFNA', 'Micro', 'CNN' } . The way this
    will work is how do I get the index of the 'link' array that
    is applicable in this example.

    Here the name of the company would be $company =
    $_SESSION['link'][0];
    If we had clicked the second row of the results table the
    name of the compnay would have been 'TFNA' i.e. $_SESSION['link'][1]
    and so on. How do I pass the index. ???




    }

    else
    {

    $company = $_GET['name'];
    USE <form name="form1" method="post"
    action="full_profile_1.php">\0\0
    AND display all the rows of the record where company_name
    ='company'

    }

    }

    else {
    redirect the user to the ERROR Page
    }

    // end of pseudo- code


    Thanks in advance guys. I know this may sound a lil' vague , but I have
    tried to present the logic and the problem.


    Pushpinder Singh Garcha Guest

  2. Similar Questions and Discussions

    1. #39223 [NEW]: $_Session and $_Get get confused
      From: dgk at visskiss dot org Operating system: Fedora PHP version: 5.1.6 PHP Bug Type: Session related Bug description: ...
    2. #39011 [NEW]: foreach($_GET as $key => &$value) causes later bugs passing $_GET as a paramete
      From: php_bug dot email at email dot digiways dot com Operating system: Windows XP PHP version: 5.1.6 PHP Bug Type: Arrays...
    3. register_globals, effects on $_GET and $_SESSION
      I read php manual many times but I can't figure out register_globals works. I m using Php 4.3.2 and register_globals on. It seems to have different...
    4. [PHP] Passing Values between Pages : $_SESSION / $_GET
      My question here is " How do I get the name of the company that was passed to this script as a $_GET Parameter. I cannot use the $company because...
    5. Passing Values Between Web Forms Pages
      I am porting an old client/server application to asp.net. I used to retrieve data into local tables (Paradox table-files on the client's disk) and...
  3. #2

    Default Re: [PHP] Passing Values between Pages : $_SESSION / $_GET

    Hello again,

    I would appreciate if someone could help me out with this one.

    Thanks again

    --Pushpinder




    On Friday, August 8, 2003, at 11:46 AM, Pushpinder Singh Garcha wrote:
    > Hello All,
    >
    > I am using php and mysql in my application which allows users to
    > search/query a database. The database is cast and has about 32 rows
    > per record. When the user fires the query, the result is in the form
    > of a table that contains only the 6 important rows of the entire
    > record. Also there is a provision to allow the user to see the full
    > record set by clicking on the link under the 'complete profile'
    > contained in the table. (as shown below). The name of this script is
    > lookup_results.php
    >
    > Here is the result for a companies in city = 'Charlotte' / Primary key
    > of the table is the name of the company.
    > -----------------------------------------------------------------------
    > -----------------------------------------------------------------------
    > -----------------------------
    > Company Name Main Contact City Website
    > E-Mail Complete
    > Profile
    > -----------------------------------------------------------------------
    > -----------------------------------------------------------------------
    > -----------------------------
    > PSG Pushpy Charlotte
    > [url]http://www.psg.com[/url] [email]psgarcha@psg.com[/email] --Link--
    > TFNA Napier Charlotte
    > [url]http://www.psg.com[/url] [email]psgarcha@psg.com[/email] --Link--
    > Micro Bates Charlotte
    > [url]http://www.psg.com[/url] [email]psgarcha@psg.com[/email] --Link--
    > CNN Garcha PS Charlotte
    > [url]http://www.psg.com[/url] [email]psgarcha@psg.com[/email] --Link--
    > -----------------------------------------------------------------------
    > -----------------------------------------------------------------------
    > -----------------------------
    >
    >
    > To see the complete profile of the company I use
    > href=\"full_profile_1.php?name=".$row['company']\0\0.
    > So once we are on the full_profile_1.php, we can see all the contents
    > of the record. Also we display a form where we can edit the results in
    > place. The logic works like this.
    >
    > // full_profile_1.php LOGIC
    >
    >
    > <?
    >
    > session_start();
    >
    > if (isset($_SESSION['validuser']))
    > {
    >
    > if($submit)
    > {
    > update the changes that the user has made to the form
    >
    >
    > My question here is " How do I get the name of the company
    > that was passed to this script as a $_GET Parameter. I cannot use the
    > $company because it is out of scope. The only other option
    > would be to use $_SESSION['link'] .... i.e. Store the names of the
    > companies in a session array. So now the array as per the
    > example above would be {'PSG','TFNA', 'Micro', 'CNN' } . The way this
    > will work is how do I get the index of the 'link' array that
    > is applicable in this example.
    >
    > Here the name of the company would be $company =
    > $_SESSION['link'][0];
    > If we had clicked the second row of the results table the
    > name of the compnay would have been 'TFNA' i.e. $_SESSION['link'][1]
    > and so on. How do I pass the index. ???
    >
    >
    >
    >
    > }
    >
    > else
    > {
    >
    > $company = $_GET['name'];
    > USE <form name="form1" method="post"
    > action="full_profile_1.php">\0\0
    > AND display all the rows of the record where company_name
    > ='company'
    >
    > }
    >
    > }
    >
    > else {
    > redirect the user to the ERROR Page
    > }
    >
    > // end of pseudo- code
    >
    >
    > Thanks in advance guys. I know this may sound a lil' vague , but I
    > have tried to present the logic and the problem.
    >
    Pushpinder Singh Garcha Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139