Php 如何使用wordpress中的自定义页面在下拉列表中获取我的库名

Php 如何使用wordpress中的自定义页面在下拉列表中获取我的库名,php,database,wordpress,gallery,image-gallery,Php,Database,Wordpress,Gallery,Image Gallery,我想在两个条件下运行我的表单 第一个用户将选择一个库事件类别,然后 然后将选择所有事件或按id选择照片 第一个优先级是下拉列表,不显示数据库中可用的库名称 <?php get_header();?> <head><style> </style> <script src="https://code.jquery.com/jquery-1.11.2.min.js" type="text/javascript"></scri

我想在两个条件下运行我的表单

  • 第一个用户将选择一个库事件类别,然后
  • 然后将选择所有事件或按id选择照片
第一个优先级是下拉列表,不显示数据库中可用的库名称

    <?php get_header();?>
<head><style>
</style>
<script src="https://code.jquery.com/jquery-1.11.2.min.js" type="text/javascript"></script>
</head>
<!------------- main page temeplate---------------------------------------------------------------------------------->
<div class="container" style="margin-top:150px;">
<div class="vc_row wpb_row vc_row-fluid vc_custom_1570471444355 vc_row-has-fill vc_row-o-full-height vc_row-o-columns-middle vc_row-o-equal-height vc_row-flex" style="min-height: 64.0809vh;"><div class="wpb_column vc_column_container vc_col-sm-6"><div class="vc_column-inner"><div class="wpb_wrapper"><div class="vc_row wpb_row vc_inner vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper">
<div class="wpb_text_column wpb_content_element ">
<div class="wpb_wrapper">
<h4 style="text-align: center;"><strong><span style="color: #000000;">Welcome to our online store, where you can view and buy your champion’s photo. Please refer to your photo ticket number (given to the athlete at the photo booth) and fill in the information below. If you do not have a ticket you may search all to find your photo.</span> </strong></h4>
</div>
</div>
<div class="wpb_widgetised_column wpb_content_element">
<div class="wpb_wrapper">   
<form method="Post" id="form1" action="index.php">
<h3>PictureUS Galley Search Form:</h3>
<select>
<?php
global $wpdb;
foreach($gallerylist as $galleryrow){
$name=$galleryrow->name; ?> 
<option value=""><?php echo $name; ?></option>
<?php }?>
</select>
<div>
<input type="radio" name="tab"  value="event" onclick="show1();event(x);" />
<b>SELECT ALL PHOTOS</b>
<input type="radio" name="tab"  value="event2" onclick="show2();event(x);" />
<b>PHOTO BY ID</b></div>
<div  class="hide"  id="div1">Enter Photo ID
<input type="number" value="" required/> </div>
<button id="mbutton" style="background-color:black; color:white;" type="submit">submit</button>
</form> <!-----------------------------form-End------------>
</div>
</div>
</div></div></div></div><div class="wpb_column vc_column_container vc_col-sm-6"><div class="vc_column-inner"><div class="wpb_wrapper"></div></div></div></div></div></div><div class="wpb_column vc_column_container vc_col-sm-6"><div class="vc_column-inner"><div class="wpb_wrapper"><div class="vc_row wpb_row vc_inner vc_row-fluid"><div class="wpb_column vc_column_container vc_col-sm-12"><div class="vc_column-inner"><div class="wpb_wrapper"></div></div></div></div>
<div class="wpb_single_image wpb_content_element vc_align_center">
<figure class="wpb_wrapper vc_figure" style="user-select: none;">
<div class="vc_single_image-wrapper vc_box_border  vc_box_border_black"><img width="422" height="542" src="https://www.pictureus.net/wp-content/uploads/2019/09/INTERNATIONAL-FIGHT-SHOWDOWN.jpg" class="vc_single_image-img attachment-full" alt="" style="user-select: none;"></div>
</figure></div>
</div></div></div></div>
</div>
<?php
require_once('wp-config.php');
global $wpdb;
$gallerydefine= $wpdb->prefix."ngg_gallery";
$query="SELECT * FROM $gallerydefine";
$gallerylist = $wpdb->get_results($query,OBJECT);
?>
<?php get_footer(); ?>

欢迎来到我们的在线商店,您可以在那里查看和购买您的冠军照片。请参考您的照片票号码(在照相亭提供给运动员)并填写以下信息。如果您没有票证,您可以搜索所有以查找您的照片
PictureUS厨房搜索表:
选择所有照片
身份证照片
输入照片ID
提交

hy all请修复此问题!要求人们“解决这个问题”是行不通的。StackOverflow不是代码编写服务。你需要写一些代码,如果你被卡住了,发布代码并解释你被卡住的地方。它没有在下拉列表中显示类别名称,这有什么不对!