天天看點

mysql 批量導入html,如何通過PHP在MySQL中插入HTML選擇值

mysql 批量導入html,如何通過PHP在MySQL中插入HTML選擇值

I have this select field:

`

City...

Tbilisi

Kutaisi

Batumi

and so on...

Now I need, when I will call this selection 'region' in PHP and then insert value in MySQL.

For example: Someone choose Tbilisi (i.e. $_POST['region']=775) and this value (775) goes to DB. I need, PHP choose from HTML equivalent of this value and instead 775 in DB insert TBILISI...

any clue?

Thanks in advance...

解決方案

Are 775>Tbilisi, 776>Kutaisi static data in html?

Simply you can create an array like

$regions = array('775'=>'Tbilisi','776'=>'Kutaisi');

and before processing form substitute values:

$region = $regions[$_POST['region']];