Connecting Tech Pros Worldwide Forums | Help | Site Map

drop down pblm in php ?...

Newbie
 
Join Date: Jan 2008
Posts: 29
#1: Mar 29 '08
Hello friends.........

i have 3 drop down,district,taluk and village. based on the district, corresponding taluk will be filled and based on taluk selected corresponding village will be filled. when i submitt the form, i want to enter village id and name to the table. my village dropdown value is village id. so i can enter village id to table but not village name... how can enter both id and name to table. name and id r 2 fields in the tables.

thanks.

hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
#2: Mar 29 '08

re: drop down pblm in php ?...


Couldn't understand your problem.
Show the code.
media3000anthony's Avatar
Newbie
 
Join Date: Mar 2008
Location: Huddersfield, England
Posts: 4
#3: Mar 30 '08

re: drop down pblm in php ?...


Hello ajaymohank,

Why not generate the dropdown like this:
[HTML]<form action='form_processor.php' action='post'>
<select name='village'>
<option value='1|Chanderi'>Chanderi</option>
<option value='5|Balender'>Balender</option>
<option value='8|Porbander'>Porbander</option>
</select>
</form>[/HTML]

Then in the PHP (form_processor.php):
[PHP]$arrVillage = split('|', $_POST['village']);
$villageId = $arrVillage[0];
$villageName = $arrVillage[1];
[/PHP]

I hope I have understood your question.

Regards,
Anthony
Reply


Similar PHP bytes