473,378 Members | 1,420 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,378 software developers and data experts.

One DROPDOWN SELECT control can it fill in 2 textboxes?

Hello dear PHP users,
I have a form with text boxes and a dropdown menu with names of cities
The adjacent textbox fills by the help of a Javascript function.
My question is, how to realize the purpose of filling the adjacent texbox
for zip values.

Or say it otherwise: how to transfer an array, filled with php to a
Javascript function.
<code>

<table>
<form name="form1" action="saved.php" method="POST">
<tr><td>Name</td><td><input type="text" name="LastName" value="<? echo
$LastName ?>"></td></tr>
<tr><td>Vorname</td><td><input type="text" name="Firstname" value="<?
echo $FirstName ?>"></td></tr>
<tr><td>Address</td><td><input type="text" name="Address" value="<? echo
$Address ?>"></td></tr>
<tr><td>ZIP</td><td><input type="text" name="ZIP" value=""></td></tr>
<tr><td>&nbsp;</td><td>

<select size="5" name="ListofCities" onChange="GiveCity()">

<?
for ($i=0; $i<$countcities; $i++)

{
echo "<option
value="."'"."$arraycities[$i]"."'"."</option>$arraycities[$i]";
}
?>

</select></td></tr>";

<tr><td>City</td><td><input type="text" name="City" value="" ></td></tr>

</code>

and the Javascript function is:
function GiveCity()
{
mycity=
document.form1.ListofCities.options[document.form1.ListofCities.options.sele
ctedIndex].value;
document.form1.City.value = mycity;

}
What I want is how to fill in by the same function the zip-textbox with the
corresponding value of the zip

Or how to fill it in with a twodimensional array

as

by example $locations = array("1000", "Brussels", "3000", "Leuven", "4000",
"Liege");

may I give an array in php to a Javascript function?
Thanks for helping.
Erwin
Jul 16 '05 #1
0 3906

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

Similar topics

0
by: Kilic Beg via .NET 247 | last post by:
Hi, I am having trouble adding a dropdown to DataGrid at runtime. I create all boundColumns and the TemplateColumn for the dropdown at runtime. The dropdown has a different datasource then the...
10
by: JL | last post by:
Does anyone have any ideas on this please? I don't know how to evaluate the no-blank selections against each other from a form as follows: . I have a form with 6 dropdown fields, each...
1
by: Andrea Williams | last post by:
I'm trying to bind to a Template Item that I created and fill the dropdown with a value from the datagrid DataSet. However, if the value is "", then I want to Insert a "" option to the list. I'm...
2
by: Steven | last post by:
This one should be a fairly simple one for you guys. I want to create a small dropDown list (custom control) and when the user selects anyone of the value, the control should pass back the Selected...
0
by: Kay | last post by:
Hello, I have developed a web custom control, I want one of the properties of the control to appear as a dropdown list so the user can select from the list. My question is: how do I define an...
0
by: Kay | last post by:
Hello, I have developed a web custom control, I want one of the properties of the control to appear as a dropdown list so the user can select from the list. My question is: how do I define an...
2
by: Spartaco | last post by:
I have a dropdown control into a page and a gridview, both are associated to two SqlDataSource controls, one of them is used to fill the DropDownControl, that is meant to be a filter over the query...
5
by: jung_h_park | last post by:
From: jung_h_park@yahoo.com Newsgroups: microsoft.public.dotnet.framework.aspnet Subject: Dropdown List not retaining its SelectedValue Date: Mon, 26 Jun 2006 21:02:57 -0700 Hello, My...
2
by: JJ297 | last post by:
I have a dropdown list populated via a database. I edited the dropdown list to have "select a topic" to always appear when the drop down loads. Now if a user selects a dropdown item it goes into...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...

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.