-1
如何從外部js文件顯示這個特定的下拉菜單(國家和地區)?在帶有select和option標籤的常規HTML表單中,它完美地工作,但是當使用php時它不會.js文件位於我正在使用的某個文件夾中,並且它在正常的html文件中正常工作。用PHP它不會運行。不知怎的,它似乎無法調用PHP內部的.js文件與選擇和選項如何顯示從PHP的外部js文件的Dropbox?
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
</style>
<body>
<form action="" method="POST">
Select Country (with states):
<select id="country" name="country" required></select>
<br>State:
<select name="region" id="region" required></select>
<br>
<input type="submit" name="submit" value="Registros">
<script src="locations.js"></script>
<script src="locations2.js" language="javascript"></script>
</form>
</head>
<?php
if(isset($_POST['submit'])){
echo "<tr><form action='' method='POST'>";
echo "<td><select name='technology'><option>ERP/CRM/EPM/BI</option><option>Cyber Security</option><option>Networking</option><option>Infrastructure</option><option>Big Data/M2M/IoT/Blockchain</option><option>Physical Security</option></select></td>";
echo "<td><select name='description'><option>VENDOR</option><option>VAD</option><option>VAR</option><option>CUSTOMER</option></td>";
echo "<td><select id='country' name='country'><option><script src='locations.js'></script></option></select></td>";
echo "<td><select id='region' name='region'><option><script src='locations2.js'></script></option></select></td>";
echo"</form></tr>";
}
?>
</body>
</html>
這看起來很奇怪。你能澄清這應該如何工作?請包括引用的'js'文件。 – ventiseis
其實我正在到達一個mysqli數據庫(MAMP),它使我回到之前註冊的選定選項,並且應該打開此下拉菜單以便可以更新狀態。例如,我應該能夠選擇另一個國家並說明並更新此表格。這個js文件是一個包含世界上所有國家和州的大文件。這是一個連接的下拉列表,即首先選擇國家,然後在此特定國家選擇州。對於'技術'和'描述',由於選項標籤是本地的,因此選擇一切正常。 Tks爲您提供幫助。 – Marcelo