473,473 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Java - PHP

10 New Member
Hello, I'm new in both Java and PHP and I'm trying to build a drop down menu with options for language select for a web site. I.E. :

<select onchange="window.location='whatever.php?language=' +this.value">
<option value="eng" <?if ($language == "eng") {?>selected<?}?>>English</option>
<option value="ger" <?if ($language == "ger") {?>selected<?}?>>German</option>
</select>

I wonder if the selected option value can call a javascript or some function which will display the dynamic menu as well (*.gif buttons in JavaScript with onMouseover event, for example...)

Please HELP!
Thanks
Jul 26 '06 #1
4 3263
iam_clint
1,208 Recognized Expert Top Contributor
thats the code i gave you in the php section :P yes it can try it out and i can help you with your code when you get stuck -- look at onchange event and make it call a javascript function in that function do whatever.
Jul 26 '06 #2
dujmovicv
10 New Member
thats the code i gave you in the php section :P yes it can try it out and i can help you with your code when you get stuck -- look at onchange event and make it call a javascript function in that function do whatever.

Hello iam_clint!

I'm back again with my probleme....

So, as I mentioned I've tried to combine php and java to build a dynamic menu with select form. Here is my code (example), I wonder if I'm going on the right way....
Please help if U have some good ideas... ;-)

<script language="JavaScript">

function jumpmenu(selLang)
{
var s = selLang;
echo "<img src=$s.gif>";
}

</script>

<?
print <<<HERE
<select name="select" onchange="jumpmenu(this)">
<option value="1" selected>Srpski</option>
<option value="2">Magyar</option>
<option value="3">English</option>
<option value="4">Deutsch</option>
</select>
HERE;
?>

As you can suppose it doesn't works...
Aug 11 '06 #3
iam_clint
1,208 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript">
  2. function jumpmenu(selLang) {
  3.    var s = selLang;
  4.    document.write("<img src="+s+".gif>");
  5. }
  6. </script>
  7.  
Your first problem was you were doing php type code in your javascript
Expand|Select|Wrap|Line Numbers
  1. <select name="select" onchange="jumpmenu(this.value);">
  2. <option value="1" selected>Srpski</option>
  3. <option value="2">Magyar</option>
  4. <option value="3">English</option>
  5. <option value="4">Deutsch</option>
  6. </select>
  7.  
Your second problem was jumpmenu(this) needed to be jumpmenu(this.value);
why even have your php code print that, its a static select menu. that should fix your problems that i seen so far.
Aug 11 '06 #4
dujmovicv
10 New Member
I managed to echo a select drop-down menu with 4 languages with an array:
[php]
<?php
$language = $_GET["language"];
?>
<select onchange="window.location='select.php?language='+t his.value">
<?php
$language = array(
"",
"English",
"Deutsch",
"Magyar",
"Srpski");
for ($i = 1; $i <= 4; $i++)
{
print "<option value=$i>$language[$i]</option>";
print "<h3>Language is : $language[$i]</h3>";
}
?>
</select>
[/php]

I can't see my mistake : in the select field always stays "English" and don't change to the selecteg language... The other question: the script doesn't prints the text in <h3> tag. Why is that?
Aug 15 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ravi Tallury | last post by:
Hi We are having issues with our application, certain portions of it stop responding while the rest of the application is fine. I am attaching the Java Core dump. If someone can let me know what...
1
by: ptaz | last post by:
Hi I'm trying to run a web page but I get the following error. Ca anyone please tell me a solution to this. Thanks Ptaz HTTP Status 500 - type Exception report
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
0
by: mailkhurana | last post by:
Hii , I am trying to use a type 2 driver to connect to DB2 0n AIX 5 I have a small java test to class to establish a conneciton with the db .. I am NOT using WAS or any appserver When I try to...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
12
by: Mark Fink | last post by:
I wrote a Jython class that inherits from a Java class and (thats the plan) overrides one method. Everything should stay the same. If I run this nothing happens whereas if I run the Java class it...
0
by: jaywak | last post by:
Just tried running some code on Linux (2.4.21-32.0.1.EL and Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)) and Windows XPSP2 (with Java HotSpot(TM) Client VM (build...
1
by: jaimemartin | last post by:
hello, I want to validate an xml by means of a schema (xsd). To do that first of all I´m using a SchemaFactory. The problem is that if I run the code in Windows all works fine, but If I run it in...
0
oll3i
by: oll3i | last post by:
package library.common; import java.sql.ResultSet; public interface LibraryInterface { public ResultSet getBookByAuthor(String author); public ResultSet getBookByName(String name);
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.