473,385 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PHP PRINT statement with OnChange event

I have tried every variation of the "onchange" statement below without
any actual reloading of the page. I am hoping that the PHP PRINT
statement is constructed wrong, otherwise it is javaScript error an
needs to be posted in the javaScript newsgroup.

The FireFox javaScript Console reports the following message:

Error: missing : in conditional expression
Source Code:
location.href=themes.php?scheme=(form.color_scheme s.options[form.color_schemes.selectedIndex].value)

My Code for the dropdown box is:
<form name='color_schemes' method='post' action='themes.php' >
Select a scheme:&nbsp;

<?php
print "<select name='scheme' size='1'
onchange='location.href=themes.php?scheme=(form.co lor_schemes.options[form.color_schemes.selectedIndex].value)'>\n";

//populate the dropdown selector box...
$counter = 1;

foreach ($schemes as $scheme)
{
if ($selected_theme == $counter)
print "<option value = '$counter' selected>$scheme</option>\n";
else
{
print "<option value = '$counter'>$scheme</option>\n";
}
$counter ++;
}

?>

I would appreciate any advice...its probably something that is very
trivial and a very glaring defect, but I am blind to it.

Thanks,

Miki
Jul 17 '05 #1
1 5144
> Error: missing : in conditional expression
Source Code:
location.href=themes.php?scheme=(form.color_scheme s.options[form.color_schemes.selectedIndex].value)

Your error is on that line, and it's javascript. You've not put quotes
around the URL you want to reload
try this:
location.href='themes.php?scheme='+(form.color_sch emes.options[form.color_schemes.selectedIndex].value)

Michelle wrote: I have tried every variation of the "onchange" statement below without
any actual reloading of the page. I am hoping that the PHP PRINT
statement is constructed wrong, otherwise it is javaScript error an
needs to be posted in the javaScript newsgroup.

The FireFox javaScript Console reports the following message:

Error: missing : in conditional expression
Source Code:
location.href=themes.php?scheme=(form.color_scheme s.options[form.color_schemes.selectedIndex].value)
My Code for the dropdown box is:
<form name='color_schemes' method='post' action='themes.php' >
Select a scheme:&nbsp;

<?php
print "<select name='scheme' size='1'
onchange='location.href=themes.php?scheme=(form.co lor_schemes.options[form.color_schemes.selectedIndex].value)'>\n";
//populate the dropdown selector box...
$counter = 1;

foreach ($schemes as $scheme)
{
if ($selected_theme == $counter)
print "<option value = '$counter' selected>$scheme</option>\n";
else
{
print "<option value = '$counter'>$scheme</option>\n";
}
$counter ++;
}

?>

I would appreciate any advice...its probably something that is very
trivial and a very glaring defect, but I am blind to it.

Thanks,

Miki

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Covad | last post by:
Hi all, For some reason my change() function is only called when the page loads. I'd much rather it gets called when the select changes. Here's the code: window.onload = init; function...
2
by: F. Da Costa | last post by:
Hi, I'm trying to call/ mimic an onchange function/ event after a user has clicked a checkbox. In response to which a buncch of other ones need to be checked as well. The caveat is that each of...
2
by: Asit | last post by:
In JavaScripts checks for an onChange event against the value of the textbox at the time of the last onChange event. Since an onChange Event never fired after you changed the text first time ,...
13
by: aundro | last post by:
Hello, I've been looking on the web for a solution to this problem: I create a set of checkboxes, and 2 buttons: - one is labeled "All" - the other is labeled "None" Clicking "All" is...
4
by: Zeebra3 | last post by:
Here goes: I have a web form with several asp:dropdownlists, with which, when selection is changed I want to fire an event defined in some clientside js. The content of the clientside code is...
3
by: jab3 | last post by:
Hello. I"m new to this group, and to JavaScript in general, so please forgive me if I breach local etiquette. I'm trying to implement some client-side 'dynamic' validation on a form. I'm having...
4
by: auslandt | last post by:
I have an HTML file that includes a JavaScript. I would like this JavaScript to be able to create an "onChange=<function>" attribute against the password element. Here is an example page of the...
21
by: Leena P | last post by:
i want to basically take some information for the product and let the user enter the the material required to make this product 1.first page test.php which takes product code and displays...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.