Board index » html » select onclick

select onclick

2004-01-07 05:57:00 AM
Hi,
I use to have apache 1.3 installed on my computer. I did a clean
install and went from RedHat 9.0 to SUSE 9.0. In this clean installed I
decided to try apache2. Now I am having some problems. I know that php
and mySQL are working fine. There were a few changed that I had to make
to my code to get it to work, but for the most part, my code is working.
This part of my code however is not working. I have the same code on
another computer that is running apache1 and it is working find. Did I
miss some in the setup?
<form name="act_list" border=0>
<table align="center">
<tr><td>
<select name=actors size=10
onclick="parent.bottom.location.href='./actors.php?id=' +
this.form.actors.options[this.form.actors.selectedIndex].value">
<option value=331>Animal Characters
<option value=319>Animation Characters
<option value=98>Brandy
<option value=366>Eve
<option value=249>Madonna
</select>
</td></tr>
</table>
</form>
When one of the select is click it is suppose to call the actors.php
file (which it does) and send it the value (which it does not). I do
not know why this does not work in apache2.
Thanks
Dawn
-
 

Re:select onclick

In article <7bGKb.6856$Ug4.4258@newssvr23.news.prodigy.com>,
spacerza@swbell.net says...
Quote
Hi,

I use to have apache 1.3 installed on my computer. I did a clean
install and went from RedHat 9.0 to SUSE 9.0. In this clean installed I
decided to try apache2. Now I am having some problems. I know that php
and mySQL are working fine. There were a few changed that I had to make
to my code to get it to work, but for the most part, my code is working.

<form name="act_list" border=0>
<table align="center">
<tr><td>
<select name=actors size=10
onclick="parent.bottom.location.href='./actors.php?id=' +
this.form.actors.options[this.form.actors.selectedIndex].value">
When one of the select is click it is suppose to call the actors.php
file (which it does) and send it the value (which it does not). I do
not know why this does not work in apache2.
What does actors.php do? Does it use globals or does it use $_GET or
$_POST? How is your form submitting the data - GET or POST? I think
your code in actors.php is faulty, not Apache 2.
--
Hywel I do not eat quiche
hyweljenkins.co.uk/
hyweljenkins.co.uk/mfaq.php
-

Re:select onclick

Hywel Jenkins wrote:
Quote
In article <7bGKb.6856$Ug4.4258@newssvr23.news.prodigy.com>,
spacerza@swbell.net says...

Quote
Hi,

I use to have apache 1.3 installed on my computer. I did a clean
install and went from RedHat 9.0 to SUSE 9.0. In this clean installed I
decided to try apache2. Now I am having some problems. I know that php
and mySQL are working fine. There were a few changed that I had to make
to my code to get it to work, but for the most part, my code is working.

<form name="act_list" border=0>
<table align="center">
<tr><td>
<select name=actors size=10
onclick="parent.bottom.location.href='./actors.php?id=' +
this.form.actors.options[this.form.actors.selectedIndex].value">
When one of the select is click it is suppose to call the actors.php
file (which it does) and send it the value (which it does not). I do
not know why this does not work in apache2.


What does actors.php do? Does it use globals or does it use $_GET or
$_POST? How is your form submitting the data - GET or POST? I think
your code in actors.php is faulty, not Apache 2.

This same code works in apache1. actors.php gets the id number by using
$HTTP_POST_VARS['id'] and use that number to get information from a
mysql DB and displays the information. I know the part where it gets
the info and displays it works for tests that I have run. What I don't
understand is how come I can not get the 'id' value.
Because of the '?id=' from the code above, the form is submitted using
the get method.
-

Re:select onclick

In article <2OGKb.177$s6.129095791@newssvr11.news.prodigy.com>,
spacerza@swbell.net says...
Quote
Hywel Jenkins wrote:
Quote
In article <7bGKb.6856$Ug4.4258@newssvr23.news.prodigy.com>,
spacerza@swbell.net says...

>Hi,
>
>I use to have apache 1.3 installed on my computer. I did a clean
>install and went from RedHat 9.0 to SUSE 9.0. In this clean installed I
>decided to try apache2. Now I am having some problems. I know that php
>and mySQL are working fine. There were a few changed that I had to make
>to my code to get it to work, but for the most part, my code is working.
>
><form name="act_list" border=0>
><table align="center">
><tr><td>
><select name=actors size=10
>onclick="parent.bottom.location.href='./actors.php?id=' +
>this.form.actors.options[this.form.actors.selectedIndex].value">
>When one of the select is click it is suppose to call the actors.php
>file (which it does) and send it the value (which it does not). I do
>not know why this does not work in apache2.


What does actors.php do? Does it use globals or does it use $_GET or
$_POST? How is your form submitting the data - GET or POST? I think
your code in actors.php is faulty, not Apache 2.

This same code works in apache1. actors.php gets the id number by using
$HTTP_POST_VARS['id'] and use that number to get information from a
mysql DB and displays the information. I know the part where it gets
the info and displays it works for tests that I have run. What I don't
understand is how come I can not get the 'id' value.

Because of the '?id=' from the code above, the form is submitted using
the get method.
So you're using HTTP_POST_VARS to get the value but as submitting using
GET? That's wrong.
Check REGISTER_GLOBALS in php_info() - I suspect it's off. It's not a
problem with Apache - it's your code or your PHP set-up. The POST array
is nothing to do with Apache.
--
Hywel I do not eat quiche
hyweljenkins.co.uk/
hyweljenkins.co.uk/mfaq.php
-

Re:select onclick

Dawn wrote:
Quote
Hi,

I use to have apache 1.3 installed on my computer. I did a clean
install and went from RedHat 9.0 to SUSE 9.0. In this clean installed I
decided to try apache2. Now I am having some problems. I know that php
and mySQL are working fine. There were a few changed that I had to make
to my code to get it to work, but for the most part, my code is working.

This part of my code however is not working. I have the same code on
another computer that is running apache1 and it is working find. Did I
miss some in the setup?

<form name="act_list" border=0>
A form does not have a default border. So, border=0 is unneeded.
Quote
<table align="center">
or <table style="margin:0px auto;">if you want to make your page closer
to web standards
Quote
<tr><td>
<select name=actors size=10
For various reasons, it is always preferable and desirable to quote
attribute values.
Why attribute values should always be quoted in HTML
www.cs.tut.fi/~jkorpela/qattr.html
Quote
onclick="parent.bottom.location.href='./actors.php?id=' +
this.form.actors.options[this.form.actors.selectedIndex].value">

The triggering event attribute is onchange. Also, I would code this in a
more compact manner:
onchange="parent.bottom.location.href='./actors.php?id=' +
this.options[this.selectedIndex].value;"
Quote
<option value=331>Animal Characters
Here, the value must be a string.
<option value="331">Animal Characters</option>
HTH
DU
Quote
<option value=319>Animation Characters
<option value=98>Brandy
<option value=366>Eve
<option value=249>Madonna

</select>
</td></tr>
</table>
</form>

When one of the select is click it is suppose to call the actors.php
file (which it does) and send it the value (which it does not). I do
not know why this does not work in apache2.

Thanks
Dawn
-

Re:select onclick

On Tue, 06 Jan 2004 22:38:54 +0000, Dawn wrote:
Quote
This same code works in apache1.
And an older version of PHP.
Quote
actors.php gets the id number by using $HTTP_POST_VARS['id']
Which has since been replaced with $_POST (matching $_GET, and if you
don't care which method, $_REQUEST). That's probably the bug.
You might try
<?php
$HTTP_POST_VARS = $_POST;
?>
if going through and replacing every instance of the former with the
latter is too much effort. It's a bandaid at best, though, and you'd do
far better to fix the code properly.
--
Some say the Wired doesn't have political borders like the real world,
but there are far too many nonsense-spouting anarchists or idiots who
think that pranks are a revolution.
-

Re:select onclick

DU wrote:
Quote
Dawn wrote:

Quote
Hi,

I use to have apache 1.3 installed on my computer. I did a clean
install and went from RedHat 9.0 to SUSE 9.0. In this clean installed
I decided to try apache2. Now I am having some problems. I know that
php and mySQL are working fine. There were a few changed that I had
to make to my code to get it to work, but for the most part, my code
is working.

This part of my code however is not working. I have the same code on
another computer that is running apache1 and it is working find. Did
I miss some in the setup?

<form name="act_list" border=0>


A form does not have a default border. So, border=0 is unneeded.

Quote
<table align="center">


or <table style="margin:0px auto;">if you want to make your page closer
to web standards

Quote
<tr><td>
<select name=actors size=10


For various reasons, it is always preferable and desirable to quote
attribute values.

Why attribute values should always be quoted in HTML
www.cs.tut.fi/~jkorpela/qattr.html

Quote
onclick="parent.bottom.location.href='./actors.php?id=' +
this.form.actors.options[this.form.actors.selectedIndex].value">


The triggering event attribute is onchange. Also, I would code this in a
more compact manner:

onchange="parent.bottom.location.href='./actors.php?id=' +
this.options[this.selectedIndex].value;"

Quote
<option value=331>Animal Characters


Here, the value must be a string.

<option value="331">Animal Characters</option>

HTH

DU

Quote
<option value=319>Animation Characters
<option value=98>Brandy
<option value=366>Eve
<option value=249>Madonna

</select>
</td></tr>
</table>
</form>

When one of the select is click it is suppose to call the actors.php
file (which it does) and send it the value (which it does not). I do
not know why this does not work in apache2.

Thanks
Dawn
Thank you everyone for all of your help. It looks like I will need to
get some updated HTML and PHP books. I will give these a try.
-

Re:select onclick

Owen Jacobson wrote:
Quote
Which has since been replaced with $_POST (matching $_GET, and if you
don't care which method, $_REQUEST). That's probably the bug.

You might try

<?php
$HTTP_POST_VARS = $_POST;
?>
$HTTP_POST_VARS is still set in every current version of PHP, it's just
deprecated. That can't be the problem.
-

Re:select onclick

Dawn wrote:
Quote
<form name="act_list" border=0>
<select name=actors size=10
onclick="parent.bottom.location.href='./actors.php?id=' +
this.form.actors.options[this.form.actors.selectedIndex].value">
This is really suboptimal. Try:
<form method="get" name="act_list" action="actors.php">
<select name=id size=10
onclick="parent.bottom.location.href='./actors.php?id=' +
this.form.id.options[this.form.id.selectedIndex].value">
And now your form will work for those 10%-15% of people without JavaScript.
Getting back to your question...
Quote
I know that php [is] working fine.
How? Because it worked under Apache 1.x? Because it works from the command
line? If so, that's not enough.
Check that you have the Apache2 version of mod_php installed. On Mandrake
the package is called apache2-mod_php.
Check that a basic test PHP file works:
<?php
header("Content-Type: text/plain");
echo 1+1;
?>
visit that page and you should just see a plain text file with the numeral
2.
If all that works, post back here with a test URL.
--
Toby A Inkster BSc (Hons) ARCS
Contact Me - www.goddamn.co.uk/tobyink/
-

Re:select onclick

Leif K-Brooks <eurleif@ecritters.biz>wrote in message news:<QAKKb.92$K25.74498@monger.newsread.com>...
Quote
Owen Jacobson wrote:
Quote
Which has since been replaced with $_POST (matching $_GET, and if you
don't care which method, $_REQUEST). That's probably the bug.

You might try

<?php
$HTTP_POST_VARS = $_POST;
?>

$HTTP_POST_VARS is still set in every current version of PHP, it's just
deprecated. That can't be the problem.
Is it populated if REGISTER_GLOBALS is off?
--
Hywel
-

Re:select onclick

hyweljenkins@hotmail.com (Hywel Jenkins) writes:
Quote
Leif K-Brooks <eurleif@ecritters.biz>wrote
Quote
$HTTP_POST_VARS is still set in every current version of PHP, it's just
deprecated. That can't be the problem.
Though $HTTP_POST_VARS isn't superglobal and $_POST is, which can
cause problems.
Quote
Is it populated if REGISTER_GLOBALS is off?
Yes, that just stops $foo being set to $_REQUEST['foo']
--
Chris
-

Re:select onclick

In article <87oetf9anx.fsf@dinopsis.dur.ac.uk>, c.i.morris@durham.ac.uk
says...
Quote
hyweljenkins@hotmail.com (Hywel Jenkins) writes:
Quote
Leif K-Brooks <eurleif@ecritters.biz>wrote
>$HTTP_POST_VARS is still set in every current version of PHP, it's just
>deprecated. That can't be the problem.

Though $HTTP_POST_VARS isn't superglobal and $_POST is, which can
cause problems.

Quote
Is it populated if REGISTER_GLOBALS is off?

Yes, that just stops $foo being set to $_REQUEST['foo']
Of course - I was having a blonde moment.
--
Hywel I do not eat quiche
hyweljenkins.co.uk/
hyweljenkins.co.uk/mfaq.php
-