By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,722 Members | 1,874 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,722 IT Pros & Developers. It's quick & easy.

One DROPDOWN SELECT control can it fill in 2 textboxes?

P: n/a
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.

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

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

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

echo "<option


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


and the Javascript function is:
function GiveCity()
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


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

may I give an array in php to a Javascript function?
Thanks for helping.
Jul 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.