Passing a parameter in PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • amerar@iwc.net

    Passing a parameter in PHP


    Hi All,

    I am writing some screen strictly in PHP. I have a screen with a
    combo box in it. I do not want to use forms, just links on the page.

    What I want to do, is when the user selects the value from the combo
    box, and clicks on the link, I want the value in the combo box to be
    passed as a parameter to another PHP page, and be used in that page.

    I really want to avoid forms and the whole GET/POST stuff.

    Is there any way to do this? Javascript maybe? I'm terrible at
    Javascript, so if this is the way, if you could include and example,
    I'd greatly appreciate it.

    Thanks!

  • Erwin Moller

    #2
    Re: Passing a parameter in PHP

    amerar@iwc.net wrote:
    Hi All,
    >
    I am writing some screen strictly in PHP. I have a screen with a
    combo box in it. I do not want to use forms, just links on the page.
    >
    What I want to do, is when the user selects the value from the combo
    box, and clicks on the link, I want the value in the combo box to be
    passed as a parameter to another PHP page, and be used in that page.
    >
    Well, you should rewrite all <a href=""in your page on the fly if the
    value in the box is changed.
    Add the comboboxselecti on to the current URL.
    But you said you suck at javascript, so this maight be over your head.
    (read on)
    I really want to avoid forms and the whole GET/POST stuff.
    >
    Is there any way to do this? Javascript maybe? I'm terrible at
    Javascript, so if this is the way, if you could include and example,
    I'd greatly appreciate it.
    Maybe you could set a cookie when the combobox is changed that holds the
    value of the element choosen.
    You do not have to refresh the page or anything, just set a cookie.

    Cookies are send to PHP on each request.
    eg:

    <?php
    // cookie received for combobox?
    if (isset($_COOKIE["mycombobox "])){
    // do stuff with the value in $_COOKIE["mycombobox "]
    }
    ?>

    Maybe that helps.

    Personally, if I see a combobox (or any formelement) without a
    submitbutton, I will be confused.
    Are you sure you want this?

    Regards,
    Erwin Moller
    >
    Thanks!
    >

    Comment

    • amerar@iwc.net

      #3
      Re: Passing a parameter in PHP

      On Sep 4, 11:25 am, Erwin Moller
      <Since_humans_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
      ame...@iwc.net wrote:
      Hi All,
      >
      I am writing some screen strictly in PHP. I have a screen with a
      combo box in it. I do not want to use forms, just links on the page.
      >
      What I want to do, is when the user selects the value from the combo
      box, and clicks on the link, I want the value in the combo box to be
      passed as a parameter to another PHP page, and be used in that page.
      >
      Well, you should rewrite all <a href=""in your page on the fly if the
      value in the box is changed.
      Add the comboboxselecti on to the current URL.
      But you said you suck at javascript, so this maight be over your head.
      (read on)
      >
      I really want to avoid forms and the whole GET/POST stuff.
      >
      Is there any way to do this? Javascript maybe? I'm terrible at
      Javascript, so if this is the way, if you could include and example,
      I'd greatly appreciate it.
      >
      Maybe you could set a cookie when the combobox is changed that holds the
      value of the element choosen.
      You do not have to refresh the page or anything, just set a cookie.
      >
      Cookies are send to PHP on each request.
      eg:
      >
      <?php
      // cookie received for combobox?
      if (isset($_COOKIE["mycombobox "])){
      // do stuff with the value in $_COOKIE["mycombobox "]
      }
      ?>
      >
      Maybe that helps.
      >
      Personally, if I see a combobox (or any formelement) without a
      submitbutton, I will be confused.
      Are you sure you want this?
      >
      Regards,
      Erwin Moller
      >
      >
      >
      Thanks!
      Well, the reason I do not want to use a form and submit and all is
      because I am using styles to make the limk 'pretty' and such with
      colors and all.......so, if I use a form, I have to use the boring
      standard grey buttons.


      Comment

      • amerar@iwc.net

        #4
        Re: Passing a parameter in PHP

        On Sep 4, 11:36 am, "ame...@iwc.net " <ame...@iwc.net wrote:
        On Sep 4, 11:25 am, Erwin Moller
        >
        >
        >
        <Since_humans_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
        ame...@iwc.net wrote:
        Hi All,
        >
        I am writing some screen strictly in PHP. I have a screen with a
        combo box in it. I do not want to use forms, just links on the page.
        >
        What I want to do, is when the user selects the value from the combo
        box, and clicks on the link, I want the value in the combo box to be
        passed as a parameter to another PHP page, and be used in that page.
        >
        Well, you should rewrite all <a href=""in your page on the fly if the
        value in the box is changed.
        Add the comboboxselecti on to the current URL.
        But you said you suck at javascript, so this maight be over your head.
        (read on)
        >
        I really want to avoid forms and the whole GET/POST stuff.
        >
        Is there any way to do this? Javascript maybe? I'm terrible at
        Javascript, so if this is the way, if you could include and example,
        I'd greatly appreciate it.
        >
        Maybe you could set a cookie when the combobox is changed that holds the
        value of the element choosen.
        You do not have to refresh the page or anything, just set a cookie.
        >
        Cookies are send to PHP on each request.
        eg:
        >
        <?php
        // cookie received for combobox?
        if (isset($_COOKIE["mycombobox "])){
        // do stuff with the value in $_COOKIE["mycombobox "]
        }
        ?>
        >
        Maybe that helps.
        >
        Personally, if I see a combobox (or any formelement) without a
        submitbutton, I will be confused.
        Are you sure you want this?
        >
        Regards,
        Erwin Moller
        >
        Thanks!
        >
        Well, the reason I do not want to use a form and submit and all is
        because I am using styles to make the limk 'pretty' and such with
        colors and all.......so, if I use a form, I have to use the boring
        standard grey buttons.
        And I might add, that there are several links on this page. Each
        needing the value of the combo box. So, I was hoping I can use
        something with the $_SESSION technique.....


        Comment

        • Erwin Moller

          #5
          Re: Passing a parameter in PHP

          amerar@iwc.net wrote:
          On Sep 4, 11:36 am, "ame...@iwc.net " <ame...@iwc.net wrote:
          >On Sep 4, 11:25 am, Erwin Moller
          >>
          >>
          >>
          ><Since_humans_ read_this_I_am_ spammed_too_m.. .@spamyourself. comwrote:
          >>ame...@iwc.ne t wrote:
          >>>Hi All,
          >>>I am writing some screen strictly in PHP. I have a screen with a
          >>>combo box in it. I do not want to use forms, just links on the page.
          >>>What I want to do, is when the user selects the value from the combo
          >>>box, and clicks on the link, I want the value in the combo box to be
          >>>passed as a parameter to another PHP page, and be used in that page.
          >>Well, you should rewrite all <a href=""in your page on the fly if the
          >>value in the box is changed.
          >>Add the comboboxselecti on to the current URL.
          >>But you said you suck at javascript, so this maight be over your head.
          >>(read on)
          >>>I really want to avoid forms and the whole GET/POST stuff.
          >>>Is there any way to do this? Javascript maybe? I'm terrible at
          >>>Javascript , so if this is the way, if you could include and example,
          >>>I'd greatly appreciate it.
          >>Maybe you could set a cookie when the combobox is changed that holds the
          >>value of the element choosen.
          >>You do not have to refresh the page or anything, just set a cookie.
          >>Cookies are send to PHP on each request.
          >>eg:
          >><?php
          >> // cookie received for combobox?
          >> if (isset($_COOKIE["mycombobox "])){
          >> // do stuff with the value in $_COOKIE["mycombobox "]
          >> }
          >>?>
          >>Maybe that helps.
          >>Personally, if I see a combobox (or any formelement) without a
          >>submitbutto n, I will be confused.
          >>Are you sure you want this?
          >>Regards,
          >>Erwin Moller
          >>>Thanks!
          >Well, the reason I do not want to use a form and submit and all is
          >because I am using styles to make the limk 'pretty' and such with
          >colors and all.......so, if I use a form, I have to use the boring
          >standard grey buttons.
          >
          And I might add, that there are several links on this page. Each
          needing the value of the combo box. So, I was hoping I can use
          something with the $_SESSION technique.....
          >
          >
          Yes, you could use an Ajaxoid approach to set the value of the combobox
          into a session. It is easy.

          But what happened with my cookie suggestion?
          Don't you like cookies?

          Erwin Moller

          Comment

          • amerar@iwc.net

            #6
            Re: Passing a parameter in PHP

            On Sep 4, 11:41 am, Erwin Moller
            <Since_humans_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
            ame...@iwc.net wrote:
            On Sep 4, 11:36 am, "ame...@iwc.net " <ame...@iwc.net wrote:
            On Sep 4, 11:25 am, Erwin Moller
            >
            <Since_humans_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
            >ame...@iwc.n et wrote:
            >>Hi All,
            >>I am writing some screen strictly in PHP. I have a screen with a
            >>combo box in it. I do not want to use forms, just links on the page.
            >>What I want to do, is when the user selects the value from the combo
            >>box, and clicks on the link, I want the value in the combo box to be
            >>passed as a parameter to another PHP page, and be used in that page.
            >Well, you should rewrite all <a href=""in your page on the fly if the
            >value in the box is changed.
            >Add the comboboxselecti on to the current URL.
            >But you said you suck at javascript, so this maight be over your head.
            >(read on)
            >>I really want to avoid forms and the whole GET/POST stuff.
            >>Is there any way to do this? Javascript maybe? I'm terrible at
            >>Javascript, so if this is the way, if you could include and example,
            >>I'd greatly appreciate it.
            >Maybe you could set a cookie when the combobox is changed that holds the
            >value of the element choosen.
            >You do not have to refresh the page or anything, just set a cookie.
            >Cookies are send to PHP on each request.
            >eg:
            ><?php
            > // cookie received for combobox?
            > if (isset($_COOKIE["mycombobox "])){
            > // do stuff with the value in $_COOKIE["mycombobox "]
            > }
            >?>
            >Maybe that helps.
            >Personally, if I see a combobox (or any formelement) without a
            >submitbutton , I will be confused.
            >Are you sure you want this?
            >Regards,
            >Erwin Moller
            >>Thanks!
            Well, the reason I do not want to use a form and submit and all is
            because I am using styles to make the limk 'pretty' and such with
            colors and all.......so, if I use a form, I have to use the boring
            standard grey buttons.
            >
            And I might add, that there are several links on this page. Each
            needing the value of the combo box. So, I was hoping I can use
            something with the $_SESSION technique.....
            >
            Yes, you could use an Ajaxoid approach to set the value of the combobox
            into a session. It is easy.
            >
            But what happened with my cookie suggestion?
            Don't you like cookies?
            >
            Erwin Moller
            I'm not really sure how that works. Is the cookie set when the user
            clicks the link to go to the next page? How do I refer to the
            variable(s) on the next page?


            Comment

            • Erwin Moller

              #7
              Re: Passing a parameter in PHP

              amerar@iwc.net wrote:
              On Sep 4, 11:41 am, Erwin Moller
              <Since_humans_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
              >ame...@iwc.n et wrote:
              >>On Sep 4, 11:36 am, "ame...@iwc.net " <ame...@iwc.net wrote:
              >>>On Sep 4, 11:25 am, Erwin Moller
              >>><Since_human s_read_this_I_a m_spammed_too_m ...@spamyoursel f.comwrote:
              >>>>ame...@iwc. net wrote:
              >>>>>Hi All,
              >>>>>I am writing some screen strictly in PHP. I have a screen with a
              >>>>>combo box in it. I do not want to use forms, just links on the page.
              >>>>>What I want to do, is when the user selects the value from the combo
              >>>>>box, and clicks on the link, I want the value in the combo box to be
              >>>>>passed as a parameter to another PHP page, and be used in that page.
              >>>>Well, you should rewrite all <a href=""in your page on the fly if the
              >>>>value in the box is changed.
              >>>>Add the comboboxselecti on to the current URL.
              >>>>But you said you suck at javascript, so this maight be over your head.
              >>>>(read on)
              >>>>>I really want to avoid forms and the whole GET/POST stuff.
              >>>>>Is there any way to do this? Javascript maybe? I'm terrible at
              >>>>>Javascript , so if this is the way, if you could include and example,
              >>>>>I'd greatly appreciate it.
              >>>>Maybe you could set a cookie when the combobox is changed that holds the
              >>>>value of the element choosen.
              >>>>You do not have to refresh the page or anything, just set a cookie.
              >>>>Cookies are send to PHP on each request.
              >>>>eg:
              >>>><?php
              >>>> // cookie received for combobox?
              >>>> if (isset($_COOKIE["mycombobox "])){
              >>>> // do stuff with the value in $_COOKIE["mycombobox "]
              >>>> }
              >>>>?>
              >>>>Maybe that helps.
              >>>>Personall y, if I see a combobox (or any formelement) without a
              >>>>submitbutto n, I will be confused.
              >>>>Are you sure you want this?
              >>>>Regards,
              >>>>Erwin Moller
              >>>>>Thanks!
              >>>Well, the reason I do not want to use a form and submit and all is
              >>>because I am using styles to make the limk 'pretty' and such with
              >>>colors and all.......so, if I use a form, I have to use the boring
              >>>standard grey buttons.
              >>And I might add, that there are several links on this page. Each
              >>needing the value of the combo box. So, I was hoping I can use
              >>something with the $_SESSION technique.....
              >Yes, you could use an Ajaxoid approach to set the value of the combobox
              >into a session. It is easy.
              >>
              >But what happened with my cookie suggestion?
              >Don't you like cookies?
              >>
              >Erwin Moller
              >
              Hi,
              I'm not really sure how that works. Is the cookie set when the user
              clicks the link to go to the next page?
              No, you set the cookie immediately when the user changes the value of
              the selectbox.
              Use the onChange event handler on your combobox.
              When it changes you use the selectedIndex property of the combobox to
              find the current index, which in turn you can use to get the
              corresponding value.

              If you want to learn more, go to google and search for 'javascript
              cookie tutorial', and you'll find sites like:

              Learn how to manipulate cookies using JavaScript with this tutorial. Re-usable functions for easy cookie access are provided, for use in your own scripts.


              and



              How do I refer to the
              variable(s) on the next page?
              >
              Javascript can read the cookie value. Also on the next page.
              Check the tutorials.

              Regards,
              Erwin Moller

              Comment

              • The Natural Philosopher

                #8
                Re: Passing a parameter in PHP

                amerar@iwc.net wrote:
                On Sep 4, 11:25 am, Erwin Moller
                <Since_humans_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
                >ame...@iwc.n et wrote:
                >>Hi All,
                >>I am writing some screen strictly in PHP. I have a screen with a
                >>combo box in it. I do not want to use forms, just links on the page.
                >>What I want to do, is when the user selects the value from the combo
                >>box, and clicks on the link, I want the value in the combo box to be
                >>passed as a parameter to another PHP page, and be used in that page.
                >Well, you should rewrite all <a href=""in your page on the fly if the
                >value in the box is changed.
                >Add the comboboxselecti on to the current URL.
                >But you said you suck at javascript, so this maight be over your head.
                >(read on)
                >>
                >>I really want to avoid forms and the whole GET/POST stuff.
                >>Is there any way to do this? Javascript maybe? I'm terrible at
                >>Javascript, so if this is the way, if you could include and example,
                >>I'd greatly appreciate it.
                >Maybe you could set a cookie when the combobox is changed that holds the
                >value of the element choosen.
                >You do not have to refresh the page or anything, just set a cookie.
                >>
                >Cookies are send to PHP on each request.
                >eg:
                >>
                ><?php
                > // cookie received for combobox?
                > if (isset($_COOKIE["mycombobox "])){
                > // do stuff with the value in $_COOKIE["mycombobox "]
                > }
                >?>
                >>
                >Maybe that helps.
                >>
                >Personally, if I see a combobox (or any formelement) without a
                >submitbutton , I will be confused.
                >Are you sure you want this?
                >>
                >Regards,
                >Erwin Moller
                >>
                >>
                >>
                >>Thanks!
                >
                Well, the reason I do not want to use a form and submit and all is
                because I am using styles to make the limk 'pretty' and such with
                colors and all.......so, if I use a form, I have to use the boring
                standard grey buttons.
                >
                >
                NO YOU DON"T

                see my example.

                Create your own buttons with graphics, and encapsulate them with an
                onclick..submit type slim javascript, or use URLs..

                The FORM method is needed to allow submit() to pass stuff back, or at
                least it's the easy way. You do NOT have to use the input elements tho.

                I use mixture, TEXTAREA is hard to code otherwise, TEXTS look fine,
                buttons look awful and are replaced, and FILE types are almost
                impossible to style. although I did see a neat method posted up ..you
                make them invisible and exactly superimpose a different element over the
                top. you THINK you are clicking on that, but actually you are clicking
                on a standard box underneath.

                Comment

                • The Natural Philosopher

                  #9
                  Re: Passing a parameter in PHP

                  Erwin Moller wrote:
                  amerar@iwc.net wrote:
                  >On Sep 4, 11:36 am, "ame...@iwc.net " <ame...@iwc.net wrote:
                  >>On Sep 4, 11:25 am, Erwin Moller
                  >>>
                  >>>
                  >>>
                  >><Since_humans _read_this_I_am _spammed_too_m. ..@spamyourself .comwrote:
                  >>>ame...@iwc.n et wrote:
                  >>>>Hi All,
                  >>>>I am writing some screen strictly in PHP. I have a screen with a
                  >>>>combo box in it. I do not want to use forms, just links on the page.
                  >>>>What I want to do, is when the user selects the value from the combo
                  >>>>box, and clicks on the link, I want the value in the combo box to be
                  >>>>passed as a parameter to another PHP page, and be used in that page.
                  >>>Well, you should rewrite all <a href=""in your page on the fly if the
                  >>>value in the box is changed.
                  >>>Add the comboboxselecti on to the current URL.
                  >>>But you said you suck at javascript, so this maight be over your head.
                  >>>(read on)
                  >>>>I really want to avoid forms and the whole GET/POST stuff.
                  >>>>Is there any way to do this? Javascript maybe? I'm terrible at
                  >>>>Javascrip t, so if this is the way, if you could include and example,
                  >>>>I'd greatly appreciate it.
                  >>>Maybe you could set a cookie when the combobox is changed that holds
                  >>>the
                  >>>value of the element choosen.
                  >>>You do not have to refresh the page or anything, just set a cookie.
                  >>>Cookies are send to PHP on each request.
                  >>>eg:
                  >>><?php
                  >>> // cookie received for combobox?
                  >>> if (isset($_COOKIE["mycombobox "])){
                  >>> // do stuff with the value in $_COOKIE["mycombobox "]
                  >>> }
                  >>>?>
                  >>>Maybe that helps.
                  >>>Personally , if I see a combobox (or any formelement) without a
                  >>>submitbutton , I will be confused.
                  >>>Are you sure you want this?
                  >>>Regards,
                  >>>Erwin Moller
                  >>>>Thanks!
                  >>Well, the reason I do not want to use a form and submit and all is
                  >>because I am using styles to make the limk 'pretty' and such with
                  >>colors and all.......so, if I use a form, I have to use the boring
                  >>standard grey buttons.
                  >>
                  >And I might add, that there are several links on this page. Each
                  >needing the value of the combo box. So, I was hoping I can use
                  >something with the $_SESSION technique.....
                  >>
                  >>
                  >
                  Yes, you could use an Ajaxoid approach to set the value of the combobox
                  into a session. It is easy.
                  >
                  But what happened with my cookie suggestion?
                  Don't you like cookies?
                  >
                  Cookies make you fat.

                  Why is your name familiar? ISTR it from many years ago in a different
                  Usenet context entirely..
                  Erwin Moller

                  Comment

                  • Erwin Moller

                    #10
                    Re: Passing a parameter in PHP

                    The Natural Philosopher wrote:
                    Erwin Moller wrote:
                    >amerar@iwc.net wrote:
                    >>On Sep 4, 11:36 am, "ame...@iwc.net " <ame...@iwc.net wrote:
                    >>>On Sep 4, 11:25 am, Erwin Moller
                    >>>>
                    >>>>
                    >>>>
                    >>><Since_human s_read_this_I_a m_spammed_too_m ...@spamyoursel f.comwrote:
                    >>>>ame...@iwc. net wrote:
                    >>>>>Hi All,
                    >>>>>I am writing some screen strictly in PHP. I have a screen with a
                    >>>>>combo box in it. I do not want to use forms, just links on the page.
                    >>>>>What I want to do, is when the user selects the value from the combo
                    >>>>>box, and clicks on the link, I want the value in the combo box to be
                    >>>>>passed as a parameter to another PHP page, and be used in that page.
                    >>>>Well, you should rewrite all <a href=""in your page on the fly if
                    >>>>the
                    >>>>value in the box is changed.
                    >>>>Add the comboboxselecti on to the current URL.
                    >>>>But you said you suck at javascript, so this maight be over your head.
                    >>>>(read on)
                    >>>>>I really want to avoid forms and the whole GET/POST stuff.
                    >>>>>Is there any way to do this? Javascript maybe? I'm terrible at
                    >>>>>Javascript , so if this is the way, if you could include and example,
                    >>>>>I'd greatly appreciate it.
                    >>>>Maybe you could set a cookie when the combobox is changed that
                    >>>>holds the
                    >>>>value of the element choosen.
                    >>>>You do not have to refresh the page or anything, just set a cookie.
                    >>>>Cookies are send to PHP on each request.
                    >>>>eg:
                    >>>><?php
                    >>>> // cookie received for combobox?
                    >>>> if (isset($_COOKIE["mycombobox "])){
                    >>>> // do stuff with the value in $_COOKIE["mycombobox "]
                    >>>> }
                    >>>>?>
                    >>>>Maybe that helps.
                    >>>>Personall y, if I see a combobox (or any formelement) without a
                    >>>>submitbutto n, I will be confused.
                    >>>>Are you sure you want this?
                    >>>>Regards,
                    >>>>Erwin Moller
                    >>>>>Thanks!
                    >>>Well, the reason I do not want to use a form and submit and all is
                    >>>because I am using styles to make the limk 'pretty' and such with
                    >>>colors and all.......so, if I use a form, I have to use the boring
                    >>>standard grey buttons.
                    >>>
                    >>And I might add, that there are several links on this page. Each
                    >>needing the value of the combo box. So, I was hoping I can use
                    >>something with the $_SESSION technique.....
                    >>>
                    >>>
                    >>
                    >Yes, you could use an Ajaxoid approach to set the value of the
                    >combobox into a session. It is easy.
                    >>
                    >But what happened with my cookie suggestion?
                    >Don't you like cookies?
                    >>
                    >
                    Cookies make you fat.
                    Yup.
                    I know that is a fact from firsthand experience. ;-)
                    >
                    Why is your name familiar? ISTR it from many years ago in a different
                    Usenet context entirely..
                    My name? Your name rings a bell too, but that could very well be because
                    you write in c.l.javascript or c.l.php.
                    I googled in groups with: "Erwin Moller" "the Natural Philosopher", and
                    I think we only replied to each other in comp.lang.php and here.
                    I always posted under my real name as far as I can remember.
                    Maybe you had a different nick some years ago?

                    I used to be active in java newsgroups.
                    Or maybe talk.origins where I used to spread my atheistic gospel. ;-)

                    Regards,
                    Erwin Moller

                    Comment

                    • The Natural Philosopher

                      #11
                      Re: Passing a parameter in PHP

                      Erwin Moller wrote:
                      The Natural Philosopher wrote:
                      >>
                      >Why is your name familiar? ISTR it from many years ago in a different
                      >Usenet context entirely..
                      >
                      My name? Your name rings a bell too, but that could very well be because
                      you write in c.l.javascript or c.l.php.
                      I googled in groups with: "Erwin Moller" "the Natural Philosopher", and
                      I think we only replied to each other in comp.lang.php and here.
                      I always posted under my real name as far as I can remember.
                      Maybe you had a different nick some years ago?
                      >
                      I used to be active in java newsgroups.
                      Or maybe talk.origins where I used to spread my atheistic gospel. ;-)
                      >
                      It was definitely in atheistic contexts, but not talk.origins.

                      This usenet ID is not that old. Earlier ones got spammed out and were
                      abandoned.

                      I won't reveal what they were. Not publically anyway ;-)

                      Anyway, hi, and enjoyed them enough to remember the name anyway..;-)
                      Regards,
                      Erwin Moller

                      Comment

                      Working...