选中的选项值使用oop PHP mysql从db进入下拉列表! ! [英] Selected option value get from db into dropdown using oop PHP mysql ! !
本文介绍了选中的选项值使用oop PHP mysql从db进入下拉列表! !的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<select name="school_name">
<option value="<?php echo $row[0];?>">
<?php $all= new student(); $all->selectSchool();?>
</option>
</select>
//php class
public function selectSchool()
{
$sch=mysqli_query($this->conn,"select * from school ");
while ($row = mysqli_fetch_array($sch))
{
echo $row[1];
}
}
我尝试过: < br $>
What I have tried:
引用:
这个想法是有两个学生数据表和其他用于学校数据。输入学生数据时,我们从学校表中选择一所学校。
>如何在应用程序表中保存这些选项有两个问题,另一个问题是要选择的学校的名称
>出现在同一行。
The idea is that there are two tables for students data and the other for school data. When entering student data we select a school from the school table.
> there are two problems how to save these choices in the application table and the other problem The names of the schools to be selected
> appear in the same row.
推荐答案
row [0];?>>
<?php
row[0];?>"> <?php
all = new student();
all= new student();
all-> selectSchool();?>
< / option>
< / select>
// php class
公共函数selectSchool()
{
all->selectSchool();?> </option> </select> //php class public function selectSchool() {
这篇关于选中的选项值使用oop PHP mysql从db进入下拉列表! !的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文