0
如果未選擇drop_artists
,我想要$answer
設置爲artist_name
。我也試過if(isset($_POST['drop_artists'])) {
,但沒有運氣。我究竟做錯了什麼?檢查下拉列表是否被選中 - Wordpress
if($_POST['drop_artists'] != '') {
$answer = $_POST['drop_artists'];
}else{
$answer = $_POST['artist_name'];
}
而且形式:
<form method="post" action="" id="artists-form">
<?php
$args = array(
'show_option_all' => 'Artists',
'hierarchical' => 1,
'child_of' => 406,
'orderby' => 'name',
'name' => 'drop_artists',
'hide_empty' => 0
);
wp_dropdown_categories($args); ?>
<h3 class="widget-title">Can't find the artist? Fill in below:</h3>
<input type="text" name="artist_name" value="" size="45" id="input-title"/>
<input id="submitButton" class="subput" type="submit" name="submit" value="Submit"/>
</form>
我做到了......但它沒有工作。我會再嘗試。也許我錯過了什麼。 – Ciprian
檢查$ _POST ['drop_artists']的輸出 – Haris