PHP data persistence without forms or GET methods?

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

    PHP data persistence without forms or GET methods?

    I need to be able to make a variable persistent between page
    invocations without submitting a form or sending it as a name-value
    pair in the URL. Another requirement I have is that I can't store the
    data in a cookie or a file either. Are there any solutions to this
    problem?
  • Erwin Moller

    #2
    Re: PHP data persistence without forms or GET methods?

    sebastiangarth@ gmail.com schreef:
    I need to be able to make a variable persistent between page
    invocations without submitting a form or sending it as a name-value
    pair in the URL. Another requirement I have is that I can't store the
    data in a cookie or a file either. Are there any solutions to this
    problem?
    Well, SESSION is the way to go.

    You were not completely clear if a sessionid is allowed in the
    url/form/cookie (it can be passed around via all 3).

    read more here:


    If that is no option I cannot think of anything else.
    This is what sessions were made for.

    Regards,
    Erwin Moller

    Comment

    • sebastiangarth@gmail.com

      #3
      Re: PHP data persistence without forms or GET methods?

      Thank you very much.

      Cheers,
      - Sebastian

      Comment

      • sebastiangarth@gmail.com

        #4
        Re: PHP data persistence without forms or GET methods?

        I am assuming then that there is no way to simulate that a form has
        been submitted (ie: by emedding a form with a hidden element into an
        anchor tag, for instance)?

        Comment

        • Erwin Moller

          #5
          Re: PHP data persistence without forms or GET methods?

          sebastiangarth@ gmail.com schreef:
          I am assuming then that there is no way to simulate that a form has
          been submitted (ie: by emedding a form with a hidden element into an
          anchor tag, for instance)?
          >
          Hi Sebastian,

          I cannot follow what it is that you want to accomplish.
          You said earlier you do not want to use a form to propagate information.
          Now you suggest to use a form to do excactly that.

          Please state your problem clearly, maybe we can help.
          Like this I am shooting in the dark. :-/

          Regards,
          Erwin Moller

          Comment

          • sebastiangarth@gmail.com

            #6
            Re: PHP data persistence without forms or GET methods?

            You said earlier you do not want to use a form to propagate information. Now you suggest to use a form to do excactly that.

            The problem is that most of the navigation by the user will be via
            links. I could of course imbed the variables in the URL but I would
            prefer not to send some of that information 'in the clear'. Ideally, I
            would like to send them along as a post request, but I don't see how
            this is possible without using forms.

            Comment

            • sebastiangarth@gmail.com

              #7
              Re: PHP data persistence without forms or GET methods?

              Well, anyway, your suggestion to use sessions seems like the best
              option. Thank you for your time and input.

              Regards,
              - Sebastian

              Comment

              • Jerry Stuckle

                #8
                Re: PHP data persistence without forms or GET methods?

                sebastiangarth@ gmail.com wrote:
                >You said earlier you do not want to use a form to propagate information. Now you suggest to use a form to do excactly that.
                >
                The problem is that most of the navigation by the user will be via
                links. I could of course imbed the variables in the URL but I would
                prefer not to send some of that information 'in the clear'. Ideally, I
                would like to send them along as a post request, but I don't see how
                this is possible without using forms.
                >
                It's not.

                As Erwin said - use sessions.

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

                Comment

                • The Natural Philosopher

                  #9
                  Re: PHP data persistence without forms or GET methods?

                  sebastiangarth@ gmail.com wrote:
                  I am assuming then that there is no way to simulate that a form has
                  been submitted (ie: by emedding a form with a hidden element into an
                  anchor tag, for instance)?
                  >

                  If you set hidden variables and SUBMIT - via javascript if necessary - a
                  pseudo form, then you can pass post variables.

                  What is wrong with a form anyway?

                  Comment

                  • The Natural Philosopher

                    #10
                    Re: PHP data persistence without forms or GET methods?

                    sebastiangarth@ gmail.com wrote:
                    >You said earlier you do not want to use a form to propagate information. Now you suggest to use a form to do excactly that.
                    >
                    The problem is that most of the navigation by the user will be via
                    links. I could of course imbed the variables in the URL but I would
                    prefer not to send some of that information 'in the clear'. Ideally, I
                    would like to send them along as a post request, but I don't see how
                    this is possible without using forms.
                    Us a form method=post and make the URLS and onclick=submit( ) type
                    javascript function.

                    You can have a separat javascript function set up wahetver cvariable you
                    like depending on waht is clicked.

                    Mind you, I simply use URLS and get variables mainly as they are a
                    convenience to the user, not an absolute restriction.

                    If they try to access things outside the scope of whats allowed, they
                    get a rude message back: thats pure data validatin on teh get variables.
                    \

                    Comment

                    • The Natural Philosopher

                      #11
                      Re: PHP data persistence without forms or GET methods?

                      Jerry Stuckle wrote:
                      sebastiangarth@ gmail.com wrote:
                      >>You said earlier you do not want to use a form to propagate
                      >>information . Now you suggest to use a form to do excactly that.
                      >>
                      >The problem is that most of the navigation by the user will be via
                      >links. I could of course imbed the variables in the URL but I would
                      >prefer not to send some of that information 'in the clear'. Ideally, I
                      >would like to send them along as a post request, but I don't see how
                      >this is possible without using forms.
                      >>
                      >
                      It's not.
                      >
                      As Erwin said - use sessions.
                      >
                      Which tend to use cookies or GET variables to maintain state anyway.

                      Comment

                      • Jerry Stuckle

                        #12
                        Re: PHP data persistence without forms or GET methods?

                        The Natural Philosopher wrote:
                        Jerry Stuckle wrote:
                        >sebastiangarth@ gmail.com wrote:
                        >>>You said earlier you do not want to use a form to propagate
                        >>>informatio n. Now you suggest to use a form to do excactly that.
                        >>>
                        >>The problem is that most of the navigation by the user will be via
                        >>links. I could of course imbed the variables in the URL but I would
                        >>prefer not to send some of that information 'in the clear'. Ideally, I
                        >>would like to send them along as a post request, but I don't see how
                        >>this is possible without using forms.
                        >>>
                        >>
                        >It's not.
                        >>
                        >As Erwin said - use sessions.
                        >>
                        Which tend to use cookies or GET variables to maintain state anyway.
                        >
                        Ah, I see you're showing your (lack of) intelligence again with another
                        stoopid comment from you. Read the whole thread, not just a couple of
                        posts.

                        Yes, PHP uses cookies or, if cookies are disabled, can use a GET
                        variable. But that is only for the session id, not for the actual data.
                        And by using a cookie, the session id doesn't need to be sent in the
                        GET string - which is what the op is trying to avoid.



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

                        Comment

                        • Erwin Moller

                          #13
                          Re: PHP data persistence without forms or GET methods?

                          The Natural Philosopher schreef:
                          sebastiangarth@ gmail.com wrote:
                          >>You said earlier you do not want to use a form to propagate
                          >>information . Now you suggest to use a form to do excactly that.
                          >>
                          >The problem is that most of the navigation by the user will be via
                          >links. I could of course imbed the variables in the URL but I would
                          >prefer not to send some of that information 'in the clear'. Ideally, I
                          >would like to send them along as a post request, but I don't see how
                          >this is possible without using forms.
                          >
                          Us a form method=post and make the URLS and onclick=submit( ) type
                          javascript function.
                          >
                          You can have a separat javascript function set up wahetver cvariable you
                          like depending on waht is clicked.
                          >
                          Mind you, I simply use URLS and get variables mainly as they are a
                          convenience to the user, not an absolute restriction.
                          >
                          If they try to access things outside the scope of whats allowed, they
                          get a rude message back: thats pure data validatin on teh get variables.
                          \
                          I don't think this is general good advise.
                          This method is based on JavaScript, which isn't always available.
                          Session are much easier, and do not depend on JavaScript.

                          PHP even helps, if configured that way, to add the phpsessionid to
                          cookie, formelements (as hidden), or url encoded in the url.
                          No need to do this yourself.

                          Sebastian, just have a look at how sessions work.
                          If you are on PHP version >4 (and who uses 3 in these days?) then
                          sessionsupport is easy and reliable.
                          You can even use the autostart session simply by editting your php.ini.
                          Read more here:



                          Regards,
                          Erwin Moller

                          Comment

                          • The Natural Philosopher

                            #14
                            Re: PHP data persistence without forms or GET methods?

                            Jerry Stuckle wrote:
                            The Natural Philosopher wrote:
                            >Jerry Stuckle wrote:
                            >>sebastiangarth@ gmail.com wrote:
                            >>>>You said earlier you do not want to use a form to propagate
                            >>>>information . Now you suggest to use a form to do excactly that.
                            >>>>
                            >>>The problem is that most of the navigation by the user will be via
                            >>>links. I could of course imbed the variables in the URL but I would
                            >>>prefer not to send some of that information 'in the clear'. Ideally, I
                            >>>would like to send them along as a post request, but I don't see how
                            >>>this is possible without using forms.
                            >>>>
                            >>>
                            >>It's not.
                            >>>
                            >>As Erwin said - use sessions.
                            >>>
                            >Which tend to use cookies or GET variables to maintain state anyway.
                            >>
                            >
                            Ah, I see you're showing your (lack of) intelligence again with another
                            stoopid comment from you. Read the whole thread, not just a couple of
                            posts.
                            >
                            Yes, PHP uses cookies or, if cookies are disabled, can use a GET
                            variable. But that is only for the session id, not for the actual data.
                            And by using a cookie, the session id doesn't need to be sent in the
                            GET string - which is what the op is trying to avoid.
                            >
                            >
                            >
                            It's not clear as to what his real issue actually is.

                            The original post said maintaining a state without use of post get or
                            cookie variables.

                            Saying 'then use sessions' masks the fact that sessions indeed use
                            cookies, post or get variables to maintain states.

                            Comment

                            • Jerry Stuckle

                              #15
                              Re: PHP data persistence without forms or GET methods?

                              The Natural Philosopher wrote:
                              Jerry Stuckle wrote:
                              >The Natural Philosopher wrote:
                              >>Jerry Stuckle wrote:
                              >>>sebastiangarth@ gmail.com wrote:
                              >>>>>You said earlier you do not want to use a form to propagate
                              >>>>>informatio n. Now you suggest to use a form to do excactly that.
                              >>>>>
                              >>>>The problem is that most of the navigation by the user will be via
                              >>>>links. I could of course imbed the variables in the URL but I would
                              >>>>prefer not to send some of that information 'in the clear'. Ideally, I
                              >>>>would like to send them along as a post request, but I don't see how
                              >>>>this is possible without using forms.
                              >>>>>
                              >>>>
                              >>>It's not.
                              >>>>
                              >>>As Erwin said - use sessions.
                              >>>>
                              >>Which tend to use cookies or GET variables to maintain state anyway.
                              >>>
                              >>
                              >Ah, I see you're showing your (lack of) intelligence again with
                              >another stoopid comment from you. Read the whole thread, not just a
                              >couple of posts.
                              >>
                              >Yes, PHP uses cookies or, if cookies are disabled, can use a GET
                              >variable. But that is only for the session id, not for the actual
                              >data. And by using a cookie, the session id doesn't need to be sent
                              >in the GET string - which is what the op is trying to avoid.
                              >>
                              >>
                              >>
                              It's not clear as to what his real issue actually is.
                              >
                              The original post said maintaining a state without use of post get or
                              cookie variables.
                              >
                              Saying 'then use sessions' masks the fact that sessions indeed use
                              cookies, post or get variables to maintain states.
                              >
                              It looked to me he wanted to avoid using a form because he's using links
                              instead. He didn't want to put the data in the GET url, which is
                              understandable. And he didn't want to save the data in a cookie.

                              You have to use (at least) one of the three to pass information. But
                              you don't have to hold the data in the cookie - you can use the session
                              for that and only pass the session id in the cookie.

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

                              Comment

                              Working...