Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   select onclick (http://www.velocityreviews.com/forums/t156519-select-onclick.html)

Dawn 01-06-2004 09:57 PM

select onclick
 
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

Hywel Jenkins 01-06-2004 10:26 PM

Re: select onclick
 
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.

--
Hywel I do not eat quiche
http://hyweljenkins.co.uk/
http://hyweljenkins.co.uk/mfaq.php

Dawn 01-06-2004 10:38 PM

Re: select onclick
 
Hywel Jenkins wrote:
> 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.

Hywel Jenkins 01-06-2004 11:23 PM

Re: select onclick
 
In article <2OGKb.177$s6.129095791@newssvr11.news.prodigy.com >,
spacerza@swbell.net says...
> Hywel Jenkins wrote:
> > 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
http://hyweljenkins.co.uk/
http://hyweljenkins.co.uk/mfaq.php

Owen Jacobson 01-06-2004 11:25 PM

Re: select onclick
 
On Tue, 06 Jan 2004 22:38:54 +0000, Dawn wrote:

> This same code works in apache1.


And an older version of PHP.

> 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.


DU 01-06-2004 11:26 PM

Re: select onclick
 
Dawn wrote:

> 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.

> <table align="center">


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

> <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
http://www.cs.tut.fi/~jkorpela/qattr.html

> 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;"

> <option value=331>Animal Characters


Here, the value must be a string.

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

HTH

DU

> <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


Dawn 01-07-2004 12:57 AM

Re: select onclick
 
DU wrote:
> Dawn wrote:
>
>> 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.
>
>> <table align="center">

>
>
> or <table style="margin:0px auto;"> if you want to make your page closer
> to web standards
>
>> <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
> http://www.cs.tut.fi/~jkorpela/qattr.html
>
>> 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;"
>
>> <option value=331>Animal Characters

>
>
> Here, the value must be a string.
>
> <option value="331">Animal Characters</option>
>
> HTH
>
> DU
>
>> <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.

Leif K-Brooks 01-07-2004 02:57 AM

Re: select onclick
 
Owen Jacobson wrote:
> 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.


Toby A Inkster 01-07-2004 07:54 AM

Re: select onclick
 
Dawn wrote:

> <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...

> 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 - http://www.goddamn.co.uk/tobyink/?page=132


Hywel Jenkins 01-07-2004 12:55 PM

Re: select onclick
 
Leif K-Brooks <eurleif@ecritters.biz> wrote in message news:<QAKKb.92$K25.74498@monger.newsread.com>...
> Owen Jacobson wrote:
> > 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


All times are GMT. The time now is 05:23 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57