如果未选择$answer
,我希望artist_name
设置drop_artists
。我也试过if( isset($_POST['drop_artists']) ) {
但没有运气。我做错了什么?
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>
答案 0 :(得分:0)
检查$_POST['drop_artists'] != 0