Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > select onclick

Reply
Thread Tools

select onclick

 
 
Dawn
Guest
Posts: n/a
 
      01-06-2004
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
 
Reply With Quote
 
 
 
 
Hywel Jenkins
Guest
Posts: n/a
 
      01-06-2004
In article <7bGKb.6856$(E-Mail Removed)> ,
http://www.velocityreviews.com/forums/(E-Mail Removed) 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
 
Reply With Quote
 
 
 
 
Dawn
Guest
Posts: n/a
 
      01-06-2004
Hywel Jenkins wrote:
> In article <7bGKb.6856$(E-Mail Removed)> ,
> (E-Mail Removed) 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.
 
Reply With Quote
 
Hywel Jenkins
Guest
Posts: n/a
 
      01-06-2004
In article <2OGKb.177$(E-Mail Removed) >,
(E-Mail Removed) says...
> Hywel Jenkins wrote:
> > In article <7bGKb.6856$(E-Mail Removed)> ,
> > (E-Mail Removed) 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
 
Reply With Quote
 
Owen Jacobson
Guest
Posts: n/a
 
      01-06-2004
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.

 
Reply With Quote
 
DU
Guest
Posts: n/a
 
      01-06-2004
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

 
Reply With Quote
 
Dawn
Guest
Posts: n/a
 
      01-07-2004
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.
 
Reply With Quote
 
Leif K-Brooks
Guest
Posts: n/a
 
      01-07-2004
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.

 
Reply With Quote
 
Toby A Inkster
Guest
Posts: n/a
 
      01-07-2004
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

 
Reply With Quote
 
Hywel Jenkins
Guest
Posts: n/a
 
      01-07-2004
Leif K-Brooks <(E-Mail Removed)> wrote in message news:<QAKKb.92$(E-Mail Removed)>...
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Overriding an onclick with another onclick tomlong@gmail.com Javascript 4 01-26-2006 09:26 PM
button.onclick = new Function("func2()") + button.onclick foldface@yahoo.co.uk Javascript 2 09-26-2005 08:13 AM
select of select box will select multiple in another box palmiere Javascript 1 02-09-2004 01:11 PM
Does onClick() automatically refresh select (list)boxes in IE6? Andrea Javascript 0 01-28-2004 01:45 PM
document.onclick=doIt() same as document.onclick=doIt ? bob Javascript 3 08-21-2003 12:14 PM



Advertisments