post and php (newbie question)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cplxphil@gmail.com

    post and php (newbie question)


    Hi,

    Does anyone know if it's possible to post to a page without using a
    form? For example, if I want to pass a variable to another page
    without using a cookie, is there a way to pass it using post?

    Thank you,
    Phil
  • Andrew Poelstra

    #2
    Re: post and php (newbie question)

    On 2008-08-16, cplxphil@gmail. com <cplxphil@gmail .comwrote:
    >
    Hi,
    >
    Does anyone know if it's possible to post to a page without using a
    form? For example, if I want to pass a variable to another page
    without using a cookie, is there a way to pass it using post?
    >
    Thank you,
    Phil
    The short answer is no.

    However, it might be possible to create some hack using AJAX to
    send data specific to the user's system (I don't know what might
    be unique) and then dynamically generate the rest of the page
    based on that.

    This fails spectacularly when JS is disabled, though.

    Why not just use cookies?

    --
    Andrew Poelstra apoelstra@wpsof tware.com
    To email me, use the above email addresss with .com set to .net

    Comment

    • sheldonlg

      #3
      Re: post and php (newbie question)

      Andrew Poelstra wrote:
      On 2008-08-16, cplxphil@gmail. com <cplxphil@gmail .comwrote:
      >Hi,
      >>
      >Does anyone know if it's possible to post to a page without using a
      >form? For example, if I want to pass a variable to another page
      >without using a cookie, is there a way to pass it using post?
      >>
      >Thank you,
      >Phil
      >
      The short answer is no.
      >
      However, it might be possible to create some hack using AJAX to
      send data specific to the user's system (I don't know what might
      be unique) and then dynamically generate the rest of the page
      based on that.
      >
      This fails spectacularly when JS is disabled, though.
      >
      Why not just use cookies?
      >
      Why nor just simply enclose it in a form? BTW, what happens with
      writing to cookies to pass information if the user has cookies disabled?

      Comment

      • Jerry Stuckle

        #4
        Re: post and php (newbie question)

        cplxphil@gmail. com wrote:
        Hi,
        >
        Does anyone know if it's possible to post to a page without using a
        form? For example, if I want to pass a variable to another page
        without using a cookie, is there a way to pass it using post?
        >
        Thank you,
        Phil
        >
        You can't post to a page. But why not put the variable in the $_SESSION
        array? That's what it's there for.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • Andrew

          #5
          Re: post and php (newbie question)

          On 2008-08-16, sheldonlg <sheldonlgwrote :
          Andrew Poelstra wrote:
          >On 2008-08-16, cplxphil@gmail. com <cplxphil@gmail .comwrote:
          >>Hi,
          >>>
          >>Does anyone know if it's possible to post to a page without using a
          >>form? For example, if I want to pass a variable to another page
          >>without using a cookie, is there a way to pass it using post?
          >>>
          >>Thank you,
          >>Phil
          >>
          >The short answer is no.
          >>
          >However, it might be possible to create some hack using AJAX to
          >send data specific to the user's system (I don't know what might
          >be unique) and then dynamically generate the rest of the page
          >based on that.
          >>
          >This fails spectacularly when JS is disabled, though.
          >>
          >Why not just use cookies?
          >>
          >
          Why nor just simply enclose it in a form?
          Because that would require a form-submission to reach every page.
          BTW, what happens with writing to cookies to pass information
          if the user has cookies disabled?
          I've tried browsing without cookies. Oftentimes it is much faster and
          sites are easier to use - and consistent, since they are stateless -
          but I can log into very few sites. I don't consider this a fault of
          any given site, nor do most users who have the presence-of-mind to
          disable cookies.

          The only two technically-feasable ways to maintain session data is
          through cookies or URL rewriting. The former will not, as you say,
          work without cookies, but the latter is fraught with peril.

          --
          Andrew Poelstra apoelstra@wpsof tware.com
          To email me, use the above email addresss with .com set to .net

          Comment

          • Andrew

            #6
            Re: post and php (newbie question)

            On 2008-08-16, Jerry Stuckle <jstucklex@attg lobal.netwrote:
            cplxphil@gmail. com wrote:
            >Hi,
            >>
            >Does anyone know if it's possible to post to a page without using a
            >form? For example, if I want to pass a variable to another page
            >without using a cookie, is there a way to pass it using post?
            >>
            >Thank you,
            >Phil
            >>
            >
            You can't post to a page. But why not put the variable in the $_SESSION
            array? That's what it's there for.
            >
            $_SESSION still depends on cookies or URL rewriting behind the scenes to
            keep its session data associated with the appropriate user.


            --
            Andrew Poelstra apoelstra@wpsof tware.com
            To email me, use the above email addresss with .com set to .net

            Comment

            • raashid bhatt

              #7
              Re: post and php (newbie question)

              On Aug 15, 9:53 pm, cplxp...@gmail. com wrote:
              Hi,
              >
              Does anyone know if it's possible to post to a page without using a
              form?  For example, if I want to pass a variable to another page
              without using a cookie, is there a way to pass it using post?
              >
              Thank you,
              Phil
              Yes why not it can be done with AJAX

              Comment

              • Andrew Poelstra

                #8
                Re: post and php (newbie question)

                On 2008-08-16, raashid bhatt <raashid_hbk@ya hoo.comwrote:
                On Aug 15, 9:53 pm, cplxp...@gmail. com wrote:
                >Hi,
                >>
                >Does anyone know if it's possible to post to a page without using a
                >form?  For example, if I want to pass a variable to another page
                >without using a cookie, is there a way to pass it using post?
                >>
                >Thank you,
                >Phil
                >
                Yes why not it can be done with AJAX
                Because AJAX requires javascript, which should never be used for
                site-critical functionality.

                --
                Andrew Poelstra apoelstra@wpsof tware.com
                To email me, use the above email addresss with .com set to .net

                Comment

                • Michael Fesser

                  #9
                  Re: post and php (newbie question)

                  ..oO(Andrew)
                  >On 2008-08-16, Jerry Stuckle <jstucklex@attg lobal.netwrote:
                  >>
                  >You can't post to a page. But why not put the variable in the $_SESSION
                  >array? That's what it's there for.
                  >>
                  >
                  >$_SESSION still depends on cookies or URL rewriting behind the scenes to
                  >keep its session data associated with the appropriate user.
                  Sure, but it's the correct way for passing data from one page to another
                  and in such cases I simply require a session cookie on my sites.

                  Micha

                  Comment

                  • Michael Fesser

                    #10
                    Re: post and php (newbie question)

                    ..oO(raashid bhatt)
                    >On Aug 15, 9:53 pm, cplxp...@gmail. com wrote:
                    >Hi,
                    >>
                    >Does anyone know if it's possible to post to a page without using a
                    >form?  For example, if I want to pass a variable to another page
                    >without using a cookie, is there a way to pass it using post?
                    >>
                    >Thank you,
                    >Phil
                    >
                    >Yes why not it can be done with AJAX
                    AJAX will cause usability and accessibility problems if not done
                    properly. And in this case it's definitely the wrong tool.

                    Micha

                    Comment

                    • cplxphil@gmail.com

                      #11
                      Re: post and php (newbie question)


                      Thank you everyone for the replies. I suppose that the best answer is
                      to use variables in $_SESSION? I am just learning PHP; while I'm
                      pretty good at C++, I've never done serious web programming before, so
                      while I had just learned about cookies, I haven't gotten to the
                      session tutorial yet.

                      Thanks again for the info. I have a follow-up question, if that's
                      alright...can anyone recommend a single PHP book that is good for
                      picking up PHP quickly for web application development that is geared
                      towards people with a programming background? I have the PHP for
                      Dummies guide somewhere, but as I recall it wasn't very advanced. I
                      read somewhere about the Safari books...are they any good?

                      Thanks again,
                      Phil

                      Comment

                      • Andrew Poelstra

                        #12
                        Re: post and php (newbie question)

                        On 2008-08-16, cplxphil@gmail. com <cplxphil@gmail .comwrote:
                        >
                        Thank you everyone for the replies. I suppose that the best answer is
                        to use variables in $_SESSION? I am just learning PHP; while I'm
                        pretty good at C++, I've never done serious web programming before, so
                        while I had just learned about cookies, I haven't gotten to the
                        session tutorial yet.
                        >
                        Thanks again for the info. I have a follow-up question, if that's
                        alright...can anyone recommend a single PHP book that is good for
                        picking up PHP quickly for web application development that is geared
                        towards people with a programming background? I have the PHP for
                        Dummies guide somewhere, but as I recall it wasn't very advanced. I
                        read somewhere about the Safari books...are they any good?
                        >
                        I learnt a lot from Professional PHP5, ISBN 978-0764572821.

                        It also had a very useful chapter on session handling.

                        --
                        Andrew Poelstra apoelstra@wpsof tware.com
                        To email me, use the above email addresss with .com set to .net

                        Comment

                        • Jerry Stuckle

                          #13
                          Re: post and php (newbie question)

                          Andrew wrote:
                          On 2008-08-16, Jerry Stuckle <jstucklex@attg lobal.netwrote:
                          >cplxphil@gmail. com wrote:
                          >>Hi,
                          >>>
                          >>Does anyone know if it's possible to post to a page without using a
                          >>form? For example, if I want to pass a variable to another page
                          >>without using a cookie, is there a way to pass it using post?
                          >>>
                          >>Thank you,
                          >>Phil
                          >>>
                          >You can't post to a page. But why not put the variable in the $_SESSION
                          >array? That's what it's there for.
                          >>
                          >
                          $_SESSION still depends on cookies or URL rewriting behind the scenes to
                          keep its session data associated with the appropriate user.
                          >
                          >
                          And anyone who doesn't allow any of that isn't going to be visiting many
                          websites. Virtually every website (at least the good ones) which use
                          logins uses sessions in one language or another. And virtually every
                          site which saves data between pages uses sessions and/or cookies at some
                          time or another.

                          If you don't want to use cookies and don't want to use sessions, then
                          you must either post the data from a form or put in the in the URL.
                          That's the only way you can pass data between pages.

                          --
                          =============== ===
                          Remove the "x" from my email address
                          Jerry Stuckle
                          JDS Computer Training Corp.
                          jstucklex@attgl obal.net
                          =============== ===

                          Comment

                          • The Natural Philosopher

                            #14
                            Re: post and php (newbie question)

                            Michael Fesser wrote:
                            .oO(Andrew)
                            >
                            >On 2008-08-16, Jerry Stuckle <jstucklex@attg lobal.netwrote:
                            >>You can't post to a page. But why not put the variable in the $_SESSION
                            >>array? That's what it's there for.
                            >>>
                            >$_SESSION still depends on cookies or URL rewriting behind the scenes to
                            >keep its session data associated with the appropriate user.
                            >
                            Sure, but it's the correct way for passing data from one page to another
                            and in such cases I simply require a session cookie on my sites.
                            >
                            Micha
                            Its not the 'correct' way. Its 'A' way.

                            It has its good and bad points like anything else.

                            Comment

                            • Michael Fesser

                              #15
                              Re: post and php (newbie question)

                              ..oO(The Natural Philosopher)
                              >Michael Fesser wrote:
                              >>
                              >Sure, but it's the correct way for passing data from one page to another
                              >and in such cases I simply require a session cookie on my sites.
                              >>
                              >Its not the 'correct' way. Its 'A' way.
                              >
                              >It has its good and bad points like anything else.
                              It's the correct way, since the alternatives have much more drawbacks
                              and security issues.

                              Micha

                              Comment

                              Working...