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.p hp" 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>  ;</td><td>
<select size="5" name="ListofCit ies" onChange="GiveC ity()">
<?
for ($i=0; $i<$countcities ; $i++)
{
echo "<option
value="."'"."$a rraycities[$i]"."'"."</option>$arrayci ties[$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.op tions[document.form1. ListofCities.op tions.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
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.p hp" 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>  ;</td><td>
<select size="5" name="ListofCit ies" onChange="GiveC ity()">
<?
for ($i=0; $i<$countcities ; $i++)
{
echo "<option
value="."'"."$a rraycities[$i]"."'"."</option>$arrayci ties[$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.op tions[document.form1. ListofCities.op tions.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