By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,011 Members | 1,000 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,011 IT Pros & Developers. It's quick & easy.

Passing a parameter in PHP

P: n/a

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!

Sep 4 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
am****@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 comboboxselection 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!
Sep 4 '07 #2

P: n/a
On Sep 4, 11:25 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.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 comboboxselection 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.
Sep 4 '07 #3

P: n/a
On Sep 4, 11:36 am, "ame...@iwc.net" <ame...@iwc.netwrote:
On Sep 4, 11:25 am, Erwin Moller

<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.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 comboboxselection 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.....
Sep 4 '07 #4

P: n/a
am****@iwc.net wrote:
On Sep 4, 11:36 am, "ame...@iwc.net" <ame...@iwc.netwrote:
>On Sep 4, 11:25 am, Erwin Moller

<Since_humans_read_this_I_am_spammed_too_m...@spa myourself.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 comboboxselection 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
Sep 4 '07 #5

P: n/a
On Sep 4, 11:41 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
ame...@iwc.net wrote:
On Sep 4, 11:36 am, "ame...@iwc.net" <ame...@iwc.netwrote:
On Sep 4, 11:25 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.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 comboboxselection 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?
Sep 4 '07 #6

P: n/a
am****@iwc.net wrote:
On Sep 4, 11:41 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
>ame...@iwc.net wrote:
>>On Sep 4, 11:36 am, "ame...@iwc.net" <ame...@iwc.netwrote:
On Sep 4, 11:25 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@s pamyourself.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 comboboxselection 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
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:

http://www.elated.com/articles/javascript-and-cookies/

and

http://www.echoecho.com/jscookies.htm

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
Sep 4 '07 #7

P: n/a
am****@iwc.net wrote:
On Sep 4, 11:25 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.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 comboboxselection 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.
Sep 4 '07 #8

P: n/a
Erwin Moller wrote:
am****@iwc.net wrote:
>On Sep 4, 11:36 am, "ame...@iwc.net" <ame...@iwc.netwrote:
>>On Sep 4, 11:25 am, Erwin Moller

<Since_humans_read_this_I_am_spammed_too_m...@sp amyourself.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 comboboxselection 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?
Cookies make you fat.

Why is your name familiar? ISTR it from many years ago in a different
Usenet context entirely..
Erwin Moller
Sep 4 '07 #9

P: n/a
The Natural Philosopher wrote:
Erwin Moller wrote:
>am****@iwc.net wrote:
>>On Sep 4, 11:36 am, "ame...@iwc.net" <ame...@iwc.netwrote:
On Sep 4, 11:25 am, Erwin Moller

<Since_humans_read_this_I_am_spammed_too_m...@s pamyourself.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 comboboxselection 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?

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
Sep 5 '07 #10

P: n/a
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
Sep 5 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.