Session_register problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cenker Sisman

    Session_register problem

    My problem is I cannot set session variables correctly.
    I have tried both PHP 4.2.2 and 4.3.3, with register_global is ON.
    But I cannot manage to see the desired result.
    My configuration for PHP 4.2.2 is
    Redhat Linux 8.0
    apache_1.3.28
    php 4.2.2

    What I am doing wrong ?
    Thank you in advance,
    Cenker Sisman

    FIRST CODE: deneme.php
    <?
    ini_set('displa y_errors', 1);
    ini_set('log_er rors', 0);
    ini_set('error_ reporting', E_ALL);

    session_start() ;
    session_registe r("sdeneme");
    $sdeneme='DENEM E';
    header("Locatio n: deneme1.php");
    ?>

    SECOND CODE: deneme1.php

    <?
    ini_set('displa y_errors', 1);
    ini_set('log_er rors', 0);
    ini_set('error_ reporting', E_ALL);
    session_start() ;
    echo ($sdeneme);
    ?>

    BROWSER OUTPUT
    Notice: Undefined variable: sdeneme in /www1/htdocs/deneme1.php on line 8
  • R. Rajesh Jeba Anbiah

    #2
    Re: Session_registe r problem

    groups@cenker.c om (Cenker Sisman) wrote in message news:<8833190b. 0310310304.5bab 8892@posting.go ogle.com>...[color=blue]
    > FIRST CODE: deneme.php
    > <?
    > ini_set('displa y_errors', 1);
    > ini_set('log_er rors', 0);
    > ini_set('error_ reporting', E_ALL);
    >
    > session_start() ;
    > session_registe r("sdeneme");
    > $sdeneme='DENEM E';[/color]

    It is old style. Instead try $_SESSION['foo'] = "new value";

    And then in second script read as
    echo $_SESSION['foo'];

    ---
    "He who created the god was a fool; he who spreads his name is a
    scoundrel and he who worships him is a barbarian."---Periyar, Famous
    Tamil Rationalist
    Email: rrjanbiah-at-Y!com

    Comment

    • Larry Jaques

      #3
      Re: Session_registe r problem

      On 31 Oct 2003 23:52:12 -0800, ng4rrjanbiah@re diffmail.com (R. Rajesh
      Jeba Anbiah) brought forth from the murky depths:
      [color=blue]
      >groups@cenker. com (Cenker Sisman) wrote in message news:<8833190b. 0310310304.5bab 8892@posting.go ogle.com>...[color=green]
      >> FIRST CODE: deneme.php
      >> <?
      >> ini_set('displa y_errors', 1);
      >> ini_set('log_er rors', 0);
      >> ini_set('error_ reporting', E_ALL);
      >>
      >> session_start() ;
      >> session_registe r("sdeneme");
      >> $sdeneme='DENEM E';[/color]
      >
      > It is old style. Instead try $_SESSION['foo'] = "new value";
      >
      > And then in second script read as
      >echo $_SESSION['foo'];[/color]

      How do you register a session var without a value using the new
      style? All the examples I've seen have values. I want it to be a
      var, not a value. Would I use something like this:

      $_SESSION['foo'] = $foonew;

      and fill $foonew later in the form?


      --
      Music washes away from the soul the dust of everyday life.
      ---- --Unknown

      Comment

      • R. Rajesh Jeba Anbiah

        #4
        Re: Session_registe r problem

        Larry Jaques <jake@di\/ersify.com> wrote in message news:<igr7qv8tb tljomigm7htj9tk vginfq9p6m@4ax. com>...[color=blue]
        > On 31 Oct 2003 23:52:12 -0800, ng4rrjanbiah@re diffmail.com (R. Rajesh
        > Jeba Anbiah) brought forth from the murky depths:
        >[color=green]
        > >groups@cenker. com (Cenker Sisman) wrote in message news:<8833190b. 0310310304.5bab 8892@posting.go ogle.com>...[color=darkred]
        > >> FIRST CODE: deneme.php
        > >> <?
        > >> ini_set('displa y_errors', 1);
        > >> ini_set('log_er rors', 0);
        > >> ini_set('error_ reporting', E_ALL);
        > >>
        > >> session_start() ;
        > >> session_registe r("sdeneme");
        > >> $sdeneme='DENEM E';[/color]
        > >
        > > It is old style. Instead try $_SESSION['foo'] = "new value";
        > >
        > > And then in second script read as
        > >echo $_SESSION['foo'];[/color]
        >
        > How do you register a session var without a value using the new
        > style? All the examples I've seen have values. I want it to be a
        > var, not a value. Would I use something like this:
        >
        > $_SESSION['foo'] = $foonew;
        >
        > and fill $foonew later in the form?[/color]

        Sorry, I couldn't understand what do you mean here... Could you
        provide more details? And, what is the purpose of your question?

        ---
        "He who created the god was a fool; he who spreads his name is a
        scoundrel and he who worships him is a barbarian."---Periyar, Famous
        Tamil Rationalist
        Email: rrjanbiah-at-Y!com

        Comment

        • Larry Jaques

          #5
          Re: Session_registe r problem

          On 2 Nov 2003 20:29:01 -0800, ng4rrjanbiah@re diffmail.com (R. Rajesh
          Jeba Anbiah) brought forth from the murky depths:
          [color=blue]
          >Larry Jaques <jake@di\/ersify.com> wrote in message news:<igr7qv8tb tljomigm7htj9tk vginfq9p6m@4ax. com>...[color=green]
          >> On 31 Oct 2003 23:52:12 -0800, ng4rrjanbiah@re diffmail.com (R. Rajesh
          >> Jeba Anbiah) brought forth from the murky depths:
          >>[color=darkred]
          >> >groups@cenker. com (Cenker Sisman) wrote in message news:<8833190b. 0310310304.5bab 8892@posting.go ogle.com>...
          >> >> FIRST CODE: deneme.php
          >> >> <?
          >> >> ini_set('displa y_errors', 1);
          >> >> ini_set('log_er rors', 0);
          >> >> ini_set('error_ reporting', E_ALL);
          >> >>
          >> >> session_start() ;
          >> >> session_registe r("sdeneme");
          >> >> $sdeneme='DENEM E';
          >> >
          >> > It is old style. Instead try $_SESSION['foo'] = "new value";
          >> >
          >> > And then in second script read as
          >> >echo $_SESSION['foo'];[/color]
          >>
          >> How do you register a session var without a value using the new
          >> style? All the examples I've seen have values. I want it to be a
          >> var, not a value. Would I use something like this:
          >>
          >> $_SESSION['foo'] = $foonew;
          >>
          >> and fill $foonew later in the form?[/color]
          >
          > Sorry, I couldn't understand what do you mean here... Could you
          >provide more details? And, what is the purpose of your question?[/color]

          In past versions of PHP, I used session_registe r(foo) to register a
          var which did not need a value at the time of registration. I filled
          in that information later, from the form input. All the new style
          $_SESSION vars, such as your example above, are shown with values.
          Current versions are PHP/4.3.2, Apache/1.3.27, MySQL/4.0.15.

          My question was "Must I fill in a value at the time of session var
          creation?"

          Here is the flow of the site:

          Gift basket page contains "add to cart" button with $basketid value
          "1", $bname value "Surprise", and form action=cart1.ph p.

          On cart1.php, we show the basket name and ID based on $basketid value,
          then collect delivery address & message vars, form action=cart2.ph p .

          On cart2.php, we use $basketid to grab shipping fees from the database
          and collect a delivery date. form action cart3.php

          On cart3.php, we display the previously collected info and prepare for
          checkout or additions.

          checkout.php will (once figured out) add the data to the database
          and send email (instead of charging credit cards) so she can call
          for the card number.


          New Question: What is the best way to register, store, and be able
          to display that var data with "$_SESSION" ? Currently, I start the
          session on the cart1 page. Should I grab $bname and $basketid via
          $_POST there, then use $_SESSION vars on the rest of the pages?


          Almost all of my (self-taught) PHP/MySQL work in the past involved
          finding and displaying data from existing flatfile (membership type)
          databases so this is all new to me. I fed databases new data from CSV
          files using the "LOAD DATA LOCAL INFILE" method.

          Numerous books haven't solidified all the concepts for me yet, so I'm
          choking a bit on this shopping cart and how to finalize this site. A
          download of the scart (simplecart) class file from Manuel Lemos' PHP
          Classes site looks promising but I'm not sure of the insertion points.

          I welcome any help I can get. Thanks.

          Comment

          • R. Rajesh Jeba Anbiah

            #6
            Re: Session_registe r problem

            Larry Jaques <jake@di\/ersify.com> wrote in message news:<dlucqvo1d 23h63fjua8t350n r1heb7ukht@4ax. com>...[color=blue]
            > On 2 Nov 2003 20:29:01 -0800, ng4rrjanbiah@re diffmail.com (R. Rajesh
            > Jeba Anbiah) brought forth from the murky depths:[/color]
            [color=blue]
            > In past versions of PHP, I used session_registe r(foo) to register a
            > var which did not need a value at the time of registration. I filled
            > in that information later, from the form input. All the new style
            > $_SESSION vars, such as your example above, are shown with values.
            > Current versions are PHP/4.3.2, Apache/1.3.27, MySQL/4.0.15.
            >
            > My question was "Must I fill in a value at the time of session var
            > creation?"[/color]

            Don't create the session var unless you value to store. Or just
            store "" while creating the var.
            [color=blue]
            >
            > Here is the flow of the site:
            >
            > Gift basket page contains "add to cart" button with $basketid value
            > "1", $bname value "Surprise", and form action=cart1.ph p.
            >
            > On cart1.php, we show the basket name and ID based on $basketid value,
            > then collect delivery address & message vars, form action=cart2.ph p .
            >
            > On cart2.php, we use $basketid to grab shipping fees from the database
            > and collect a delivery date. form action cart3.php
            >
            > On cart3.php, we display the previously collected info and prepare for
            > checkout or additions.
            >
            > checkout.php will (once figured out) add the data to the database
            > and send email (instead of charging credit cards) so she can call
            > for the card number.
            >
            >
            > New Question: What is the best way to register, store, and be able
            > to display that var data with "$_SESSION" ? Currently, I start the
            > session on the cart1 page. Should I grab $bname and $basketid via
            > $_POST there, then use $_SESSION vars on the rest of the pages?[/color]

            IMHO, in this case, pass the ids via hidden form variables and
            grab it via $_POST. I don't see any necessity for the $_SESSION here
            in this case.

            The reason why people go for session in shopping cart is: they
            will allow the user to add the products into basket (which is nothing
            but session vars). And during checkout, they'll process the content of
            the basket (that is grab the stored info from the session vars). See


            [color=blue]
            > Almost all of my (self-taught) PHP/MySQL work in the past involved
            > finding and displaying data from existing flatfile (membership type)
            > databases so this is all new to me. I fed databases new data from CSV
            > files using the "LOAD DATA LOCAL INFILE" method.
            >
            > Numerous books haven't solidified all the concepts for me yet, so I'm
            > choking a bit on this shopping cart and how to finalize this site. A
            > download of the scart (simplecart) class file from Manuel Lemos' PHP
            > Classes site looks promising but I'm not sure of the insertion points.[/color]

            Try osCommerce ( http://www.oscommerce.com/ ). Looking at the
            functionalities and source code may help you better.

            ---
            "Success = 10% sweat + 90% tears"
            Email: rrjanbiah-at-Y!com

            Comment

            • Larry Jaques

              #7
              Re: Session_registe r problem

              On 3 Nov 2003 21:13:43 -0800, ng4rrjanbiah@re diffmail.com (R. Rajesh
              Jeba Anbiah) brought forth from the murky depths:
              [color=blue][color=green]
              >> My question was "Must I fill in a value at the time of session var
              >> creation?"[/color]
              >
              > Don't create the session var unless you value to store. Or just
              >store "" while creating the var.[/color]

              Ah, got it. Thanks.

              [color=blue]
              > IMHO, in this case, pass the ids via hidden form variables and
              >grab it via $_POST. I don't see any necessity for the $_SESSION here
              >in this case.[/color]

              I'm primarily storing data for several pages, displaying just a few,
              and then working with them all and saving to database at the end.
              Don't all hidden vars use known values? Most of these would be filled
              in as the client gets to the page. Or were you referring to the name
              and ID fields, which I did know on the initial page?

              [color=blue]
              > The reason why people go for session in shopping cart is: they
              >will allow the user to add the products into basket (which is nothing
              >but session vars). And during checkout, they'll process the content of
              >the basket (that is grab the stored info from the session vars). See
              >http://groups.google.com/groups?thre...1748%40php.net[/color]

              OK, so $_POST vars will work for me all pages except the cart display
              page, where I'll use and manipulate $_SESSION vars? I think it's
              starting to sink in through this thick skull of mine.

              If session vars are most often used, do you know how they are doing
              the multiple carts on http://www.godiva.com ? I realize that they're
              using the dreaded lurgy (.asp) on that site, but they stack the carts
              on top of one another to send gifts to multiple addressees/addresses.
              Would that be a matter of creating additional objects on the page or
              second/third sessions, or ?

              [color=blue][color=green]
              >> Classes site looks promising but I'm not sure of the insertion points.[/color]
              >
              > Try osCommerce ( http://www.oscommerce.com/ ). Looking at the
              >functionalitie s and source code may help you better.[/color]

              I downloaded that and nearly soiled my pants when I saw that the
              unzipped program had OVER 1,000 associated files, mostly PHP.
              Where would one START? =:0 And, of course, I'm on a Winbox and
              don't have a local box with LAMP on it for easier testing. <sigh>

              Thanks for your help. I'll keep plugging along.


              -- Friends Don't Let Friends Eat Turkey and Drive --

              Comment

              • R. Rajesh Jeba Anbiah

                #8
                Re: Session_registe r problem

                Larry Jaques <jake@di\/ersify.com> wrote in message news:<fohfqv087 han3518g5hknnkq bnnb5hd9e6@4ax. com>...[color=blue]
                > On 3 Nov 2003 21:13:43 -0800, ng4rrjanbiah@re diffmail.com (R. Rajesh
                > Jeba Anbiah) brought forth from the murky depths:
                >
                >[color=green]
                > > The reason why people go for session in shopping cart is: they
                > >will allow the user to add the products into basket (which is nothing
                > >but session vars). And during checkout, they'll process the content of
                > >the basket (that is grab the stored info from the session vars). See
                > >http://groups.google.com/groups?thre...1748%40php.net[/color]
                >
                > OK, so $_POST vars will work for me all pages except the cart display
                > page, where I'll use and manipulate $_SESSION vars? I think it's
                > starting to sink in through this thick skull of mine.
                >
                > If session vars are most often used, do you know how they are doing
                > the multiple carts on http://www.godiva.com ?[/color]

                If I guess right, they use the same logic as stated in


                I hope, you can get this logic by trial and error.
                [color=blue]
                > I realize that they're
                > using the dreaded lurgy (.asp) on that site, but they stack the carts
                > on top of one another to send gifts to multiple addressees/addresses.
                > Would that be a matter of creating additional objects on the page or
                > second/third sessions, or ?
                >
                >[color=green][color=darkred]
                > >> Classes site looks promising but I'm not sure of the insertion points.[/color]
                > >
                > > Try osCommerce ( http://www.oscommerce.com/ ). Looking at the
                > >functionalitie s and source code may help you better.[/color]
                >
                > I downloaded that and nearly soiled my pants when I saw that the
                > unzipped program had OVER 1,000 associated files, mostly PHP.
                > Where would one START? =:0 And, of course, I'm on a Winbox and
                > don't have a local box with LAMP on it for easier testing. <sigh>[/color]

                FYI, I too work in WAMP. I couldn't understand your problem. They
                have more plugins; it is so generalized, and so they have more codes.
                You just see the page that use cart and then look at the source. If
                you do Google, you may get simple PHP shopping cart script (I hope).

                ---
                "If there is a God, he must be a sadist!"
                Email: rrjanbiah-at-Y!com

                Comment

                • Larry Jaques

                  #9
                  Re: Session_registe r problem

                  On 4 Nov 2003 21:01:10 -0800, ng4rrjanbiah@re diffmail.com (R. Rajesh
                  Jeba Anbiah) brought forth from the murky depths:
                  [color=blue][color=green]
                  >> OK, so $_POST vars will work for me all pages except the cart display
                  >> page, where I'll use and manipulate $_SESSION vars? I think it's
                  >> starting to sink in through this thick skull of mine.[/color][/color]

                  Well, I tried my thoughts above and it doesn't work. Data entered
                  from the first form (product page) travels to the first cart page
                  but not beyond. How do I carry those vars through the cycle without
                  a session?!?

                  Vars $basketid and $bname from the product page go to Cart1.php and
                  show up as #"2" and "Enjoy Paradise with fresh fruit" as expected.
                  Cart1 adds delivery address request and messages which show up on
                  the next page, but I've lost the $basketid and $bname data whether
                  I call it with the original var name, rename it, or use $_POST[bname].
                  That means the query doesn't work and I come up empty. (see below)

                  (snip of logon to DB)
                  $sql="select * from baskets where bid=\"$_POST[basketid]\" ;";
                  $sql_result=mys ql_query($sql,$ connection)
                  or die ("Query error:" . mysql_error());
                  while ($row=mysql_fet ch_array($sql_r esult))
                  {
                  $bid2 = $row["bid"];
                  $bnam2 = $row["bname"];
                  $bprice= $row["bprice"];
                  $hono = $row["honolulu"];
                  $oahu = $row["oahu"];
                  $prioi = $row["priorityoi "];
                  $prim = $row["prioritym"];
                  $fed = $row["fedex"];
                  }

                  I spotted that extra space after the \" at the end of the query
                  and removed it with no change. What am I missing? Are the
                  $_POST vars only global to a single form? If so, how do I use
                  them for this 4-page scheme?

                  [color=blue][color=green]
                  >> If session vars are most often used, do you know how they are doing
                  >> the multiple carts on http://www.godiva.com ?[/color][/color]
                  [color=blue]
                  > If I guess right, they use the same logic as stated in
                  >http://groups.google.com/groups?thre...1748%40php.net
                  >
                  > I hope, you can get this logic by trial and error.[/color]

                  Is the "foreach" line the main concept? I can't visualize PHP code yet
                  like I do with HTML.
                  // - Show
                  if( isset( $_SESSION['aBasket'] ) ) {
                  foreach ( $_SESSION['aBasket'] as $key=>$val ) {
                  echo "$key ";
                  }
                  }
                  [color=blue]
                  > FYI, I too work in WAMP. I couldn't understand your problem. They
                  >have more plugins; it is so generalized, and so they have more codes.
                  >You just see the page that use cart and then look at the source. If
                  >you do Google, you may get simple PHP shopping cart script (I hope).[/color]

                  Macromedia shows a simple one I might try to convert.

                  Thanks.


                  -- Friends Don't Let Friends Eat Turkey and Drive --

                  Comment

                  • R. Rajesh Jeba Anbiah

                    #10
                    Re: Session_registe r problem

                    Larry Jaques <jake@di\/ersify.com> wrote in message news:<65fiqvgd4 okae4hufc4423r0 t36jc60jse@4ax. com>...[color=blue]
                    > On 4 Nov 2003 21:01:10 -0800, ng4rrjanbiah@re diffmail.com (R. Rajesh
                    > Jeba Anbiah) brought forth from the murky depths:[/color]
                    [color=blue]
                    > Well, I tried my thoughts above and it doesn't work. Data entered
                    > from the first form (product page) travels to the first cart page
                    > but not beyond. How do I carry those vars through the cycle without
                    > a session?!?[/color]

                    Though I feel guilty to spoonfeed you, here is the sample code:

                    <!--page1.php -->
                    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                    <HTML>
                    <HEAD>
                    <TITLE>Page1</TITLE>
                    <META http-equiv="Content-Type" content="text/html;
                    charset=iso-8859-1">
                    </HEAD>
                    <BODY>
                    <FORM name="form1" method="post" action="page2.p hp">
                    <INPUT name="a" type="text" id="a">
                    <INPUT name="b" type="text" id="b">
                    <INPUT type="submit" name="Submit" value="Go to Page 2">
                    </FORM>
                    </BODY>
                    </HTML>


                    <!-- page2.php -->
                    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                    <HTML>
                    <HEAD>
                    <TITLE>Page2</TITLE>
                    <META http-equiv="Content-Type" content="text/html;
                    charset=iso-8859-1">
                    </HEAD>
                    <BODY>
                    <?php
                    $a = isset($_POST['a']) ? $_POST['a'] : '';
                    $b = isset($_POST['b']) ? $_POST['b'] : '';
                    ?>
                    <FORM name="form1" method="post" action="page3.p hp">
                    <INPUT name="a" type="hidden" id="a" value="<?=$a?>" >
                    <INPUT name="b" type="hidden" id="b" value="<?=$b?>" >
                    <INPUT name="c" type="text" id="c" value="">
                    <INPUT type="submit" name="Submit" value="Go to Page 3">
                    </FORM>
                    </BODY>
                    </HTML>


                    <!-- page3.php -->
                    <HTML>
                    <HEAD>
                    <TITLE>Page 3</TITLE>
                    <META http-equiv="Content-Type" content="text/html;
                    charset=iso-8859-1">
                    </HEAD>
                    <BODY>
                    <?php
                    print_r($_POST) ;
                    ?>
                    </BODY>
                    </HTML>



                    [color=blue]
                    > Vars $basketid and $bname from the product page go to Cart1.php and
                    > show up as #"2" and "Enjoy Paradise with fresh fruit" as expected.
                    > Cart1 adds delivery address request and messages which show up on
                    > the next page, but I've lost the $basketid and $bname data whether
                    > I call it with the original var name, rename it, or use $_POST[bname].
                    > That means the query doesn't work and I come up empty. (see below)
                    >
                    > (snip of logon to DB)
                    > $sql="select * from baskets where bid=\"$_POST[basketid]\" ;";[/color]

                    Always for code cleanliness, test the presence of POST variable
                    like:
                    $basketid = isset($_POST['basketid']) ? $_POST['basketid'] : 0;
                    And then use the query like
                    $sql="select * from baskets where bid='".$basketi d."'";
                    [color=blue]
                    > I spotted that extra space after the \" at the end of the query
                    > and removed it with no change. What am I missing?[/color]
                    [color=blue]
                    >Are the
                    > $_POST vars only global to a single form?[/color]

                    Yes.
                    [color=blue]
                    >If so, how do I use
                    > them for this 4-page scheme?[/color]

                    See my mock codes.
                    [color=blue][color=green][color=darkred]
                    > >> If session vars are most often used, do you know how they are doing
                    > >> the multiple carts on http://www.godiva.com ?[/color][/color]
                    >[color=green]
                    > > If I guess right, they use the same logic as stated in
                    > >http://groups.google.com/groups?thre...1748%40php.net
                    > >
                    > > I hope, you can get this logic by trial and error.[/color]
                    >
                    > Is the "foreach" line the main concept?[/color]

                    Oops! This is not a working shopping cart script. It just
                    explains the logic behind shopping cart system.
                    [color=blue]
                    >I can't visualize PHP code yet
                    > like I do with HTML.[/color]

                    So, IMHO learn PHP bit more.
                    [color=blue]
                    > // - Show
                    > if( isset( $_SESSION['aBasket'] ) ) {
                    > foreach ( $_SESSION['aBasket'] as $key=>$val ) {
                    > echo "$key ";
                    > }
                    > }[/color]

                    This is just a mock code to show the content of the basket. You
                    need to write more codes if you want to add quantity, price, etc.

                    ---
                    "The world is too dangerous to live in—not because of the people who
                    do evil, but because of the people who sit and let it happen"---Albert
                    Einstein
                    Email: rrjanbiah-at-Y!com

                    Comment

                    • Larry Jaques

                      #11
                      Re: Session_registe r problem

                      On 5 Nov 2003 20:44:56 -0800, ng4rrjanbiah@re diffmail.com (R. Rajesh
                      Jeba Anbiah) brought forth from the murky depths:
                      [color=blue]
                      >Larry Jaques <jake@di\/ersify.com> wrote in message news:<65fiqvgd4 okae4hufc4423r0 t36jc60jse@4ax. com>...[color=green]
                      >> On 4 Nov 2003 21:01:10 -0800, ng4rrjanbiah@re diffmail.com (R. Rajesh
                      >> Jeba Anbiah) brought forth from the murky depths:[/color]
                      >[color=green]
                      >> Well, I tried my thoughts above and it doesn't work. Data entered
                      >> from the first form (product page) travels to the first cart page
                      >> but not beyond. How do I carry those vars through the cycle without
                      >> a session?!?[/color]
                      >
                      > Though I feel guilty to spoonfeed you, here is the sample code:[/color]

                      Thank you for the spoonfeeding. My arms were getting tired from
                      all the flailing about I've been doing for weeks. ;)

                      [color=blue]
                      ><!-- page2.php -->
                      ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                      ><HTML>
                      ><HEAD>
                      ><TITLE>Page2 </TITLE>
                      ><META http-equiv="Content-Type" content="text/html;
                      >charset=iso-8859-1">
                      ></HEAD>
                      ><BODY>
                      ><?php
                      >$a = isset($_POST['a']) ? $_POST['a'] : '';
                      >$b = isset($_POST['b']) ? $_POST['b'] : '';
                      >?>
                      ><FORM name="form1" method="post" action="page3.p hp">
                      > <INPUT name="a" type="hidden" id="a" value="<?=$a?>" >
                      > <INPUT name="b" type="hidden" id="b" value="<?=$b?>" >
                      > <INPUT name="c" type="text" id="c" value="">
                      > <INPUT type="submit" name="Submit" value="Go to Page 3">
                      ></FORM>
                      ></BODY>
                      ></HTML>[/color]

                      Ah, it finally sinks in. I hadn't fully grokked your use of
                      the hidden form, didn't know you had meant to reiterate them
                      on subsequent pages. NOW I see how that works without sessions.


                      [color=blue]
                      ><!-- page3.php -->
                      ><HTML>
                      ><HEAD>
                      ><TITLE>Page 3</TITLE>
                      ><META http-equiv="Content-Type" content="text/html;
                      >charset=iso-8859-1">
                      ></HEAD>
                      ><BODY>
                      ><?php
                      >print_r($_POST );
                      >?>
                      ></BODY>
                      ></HTML>[/color]

                      [color=blue]
                      > Always for code cleanliness, test the presence of POST variable
                      >like:
                      >$basketid = isset($_POST['basketid']) ? $_POST['basketid'] : 0;
                      > And then use the query like
                      > $sql="select * from baskets where bid='".$basketi d."'";[/color]

                      I have been picking that up from examples in this and other
                      forums lately and now understand why. I can also preprocess
                      raw vars prior to query, another good thing for added safety.

                      [color=blue][color=green]
                      >> I spotted that extra space after the \" at the end of the query
                      >> and removed it with no change. What am I missing?[/color]
                      >[color=green]
                      >>Are the
                      >> $_POST vars only global to a single form?[/color]
                      >
                      > Yes.[/color]

                      I guess PHP and I have a different idea as to the definition
                      of the term "SUPERGLOBA L." Time for me to reread the online docs.

                      [color=blue][color=green]
                      >>I can't visualize PHP code yet
                      >> like I do with HTML.[/color]
                      >
                      > So, IMHO learn PHP bit more.[/color]

                      I fully intend to, thanks. Like I said, all of my earlier
                      clients had membership databases so all the PHP work I had
                      done prior to this was simple query/output of data.

                      Rasmus Lerdorf's book "Programmin g PHP" is now in my library
                      for immediate consumption.

                      Thanks again for all your help.


                      -- Friends Don't Let Friends Eat Turkey and Drive --

                      Comment

                      Working...