我有一个自定义页面模板,它显示一个下拉框,其中包含国家列表。用户选择该框并单击sumbit。页面然后显示该国家/地区的相关详细信息。它还显示存储在数据库中的描述。
以下sql查询用于显示数据。
$id = mysql_escape_string($_GET[\'id\']);
$row_RsInt = $wpdb->get_results("SELECT * FROM wp_num_countries",ARRAY_A);
$totalRows_RsInt = count($row_RsInt);
<form id="formITFS" name="formITFS" method="post" action="">
<select class="itfsDrp" id="country" name="country">
<?php
foreach($row_RsInt as $row_RsInts){
$selected = $_POST[\'country\'] == $row_RsInts[\'countryID\'] ? \'selected="selected"\' : \'\';
echo \'<option value="\'.$row_RsInts[\'countryID\'].\'" \'.$selected.\'>\'.$row_RsInts[\'country\'].\'</option>\';
}
?>
</select><input name="imageField2" id="imageField2" src="http://xxxxxxxx/wp-content/themes/responsive/images/rates.png" type="image">
</form>
<?php
if($_POST[\'country\'])
$country_id = $_POST[\'country\'];
else
$country_id = 1;
$countryinfo = $wpdb->get_row("SELECT * FROM wp_num_countries WHERE countryID = ".$country_id);
?>
<form action="" method="POST" name="form" id="formn">
<div id="ITFSworks">
<?php echo $countryinfo->desc; ?>
我想为每个国家创建一个单独的页面。页面将包含更多文本。当用户转到这个新页面时,会得到与自定义页面模板相同的布局。因此,如果我的perma链接是法国页面,我希望下拉列表中预选法国和法国信息,以此类推。。
我如何才能最好地实现这一点。我正在使用最新的wordpress。
最好的方法是什么。