如果状态被批准,则要创建已批准的按钮,否则将出现待处理按钮 [英] Want to create approved button if status is approved else pending button will appear

查看:82
本文介绍了如果状态被批准,则要创建已批准的按钮,否则将出现待处理按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个表add_batch和assign_student



通过使用while循环我显示add_batch表的所有主题,并在所有主题下面显示一个静态按钮。



现在我想以这样的方式创建按钮:如果学生尊重课程状态为Approved,则会显示按钮,然后会出现已批准按钮,如果状态为待处理,则会显示挂起按钮。< br $> b $ b





请程序员尽快回复。请帮帮我



我尝试了什么:



<?php 
包括'connect.php';
session_start();
$ id = $ _ SESSION ['id'];

?>

<!DOCTYPE html>
< html lang =en>
<! - BEGIN HEAD - >
< head>
<?php包括'head.php';?>
< head />
<! - END HEAD - >
< body class =page-header-fixed sidemenu-closed-hidelogo page-content-white page-md header-white white-sidebar-color logo-indigo>
< div class =page-wrapper>
<! - 开头 - >
< div class =page-header navbar navbar-fixed-top>
<?php包含'header.php';?>

< / div>
<! - 结束标题 - >
<! - 起始页面容器 - >
< div class =page-container>
<! - 开始侧边栏菜单 - >
<?php包含'menu.php';?>
<! - 结束侧边栏菜单 - >
<! - 开始页面内容 - >
< div class =page-content-wrapper>
< div class =page-content-wrapper>
< div class =page-content>
< div class =page-bar>
<?php include'./breadcrumb.php';?>
< / div>

< div class =row clearfix>

<?php

if(isset($ _ POST ['submit']))
{


$ branch_id = mysqli_real_escape_string($ conn,$ _POST ['branch_id']);
$ institute_id = mysqli_real_escape_string($ conn,$ _POST ['institute_id']);


$ res = mysqli_query($ conn,SELECT * FROM add_batch WHERE branch_id ='$ branch_id'&& institute_id ='$ institute_id');

$ product_count = mysqli_num_rows($ res);

$ course_id = $ row ['course_id'];
if($ product_count> 0){



while($ row = mysqli_fetch_array($ res)){



?>

< div class =col-md-6 col-sm-6>
< form method =POSTaction =student.php?page = subscribecourse>
< div class =card>
< div class =panel-body>

< h3><?php echo $ row ['course_name']; ?>< / H3>

< input type =hiddenname =student_namevalue =<?php echo $ s_name;?>>
< input type =hiddenname =institute_idvalue =<?php echo $ row ['institute_id'];?>>

< input type =hiddenname =branch_idvalue =<?php echo $ row ['branch_id'];?>>

< input type =hiddenname =batch_idvalue =<?php echo $ batch_id;?>>

< input type =hiddenname =course_idvalue =<?php echo $ course_id;?>>
< input type =hiddenname =course_namevalue =<?php echo $ row ['course_name'];?>>

< input type =hiddenname =student_idvalue =<?php echo $ s_id;?>>
<?php

$ res1 = mysqli_query($ conn,SELECT * FROM assign_student WHERE branch_id ='。$ branch_id。');
#$ row1 = mysqli_fetch_array($ res1);

while($ row1 = mysqli_fetch_array($ res1)){


if(($ course_id == $ row1 ['course_id'])&& ;($ row1 ['status'] =='已批准')){
#code ...
echo< button class ='btn-button default'type ='submit'name = '提交' >两者< /按钮>中;
}
其他
{
echo< button class ='btn-button default'type ='submit'name ='subscribe'> Not Taken< / button> ;
}

}

?>



< / div>
< / div>
< / form>
< / div>

<?php

}





}
否则
{
?>
< div class =col-md-12 col-sm-12>

< div class =card>
< div class =panel-body>
< h3>抱歉!在此分支中找不到任何课程< / h3>
< / div>
< / div>
< / div>
<?php
}

}


?>
< / div>
< / div>

<! - 结束页面内容 - >

< / div>
< / div>
<! - 结束页面内容 - >

< / div>
<! - 结束页面容器 - >
<! - start footer - >
<?php include'./footer.php';?>

解决方案

id =


_SESSION [ 'ID'];

?>

<!DOCTYPE html>
< html lang =en>
<! - BEGIN HEAD - >
< head>
<?php包括'head.php';?>
< head />
<! - END HEAD - >
< body class =page-header-fixed sidemenu-closed-hidelogo page-content-white page-md header-white white-sidebar-color logo-indigo>
< div class =page-wrapper>
<! - 开头 - >
< div class =page-header navbar navbar-fixed-top>
<?php包含'header.php';?>

< / div>
<! - 结束标题 - >
<! - 起始页面容器 - >
< div class =page-container>
<! - 开始侧边栏菜单 - >
<?php包含'menu.php';?>
<! - 结束侧边栏菜单 - >
<! - 开始页面内容 - >
< div class =page-content-wrapper>
< div class =page-content-wrapper>
< div class =page-content>
< div class =page-bar>
<?php include'./breadcrumb.php';?>
< / div>

< div class =row clearfix>如果(isset(


_POST ['submit']))
{

I have two table add_batch and assign_student

By using while loop I display all subject of add_batch table with a static button below all subject.

Now I want to create button in such a way that from assign_student table if student with respect course status is Approved then Approved button will appear and if status is pending then Pending Button will appear.



Please programmers reply as soon as possible. Help me please

What I have tried:

<?php
include 'connect.php';
session_start();
$id=$_SESSION['id']; 

?>

<!DOCTYPE html>
<html lang="en">
<!-- BEGIN HEAD -->
<head>
<?php include 'head.php';?>
<head/>
 <!-- END HEAD -->
<body class="page-header-fixed sidemenu-closed-hidelogo page-content-white page-md header-white white-sidebar-color logo-indigo">
    <div class="page-wrapper">
        <!-- start header -->
        <div class="page-header navbar navbar-fixed-top">
           <?php include 'header.php';?>

        </div>
        <!-- end header --> 
        <!-- start page container -->
        <div class="page-container">
            <!-- start sidebar menu -->
            <?php include 'menu.php';?>
            <!-- end sidebar menu --> 
            <!-- start page content -->
            <div class="page-content-wrapper">
                <div class="page-content-wrapper">
                <div class="page-content">
                    <div class="page-bar">
                         <?php include './breadcrumb.php';?>
                    </div>
                     
		            <div class="row clearfix">

                    <?php

                    if(isset($_POST['submit']))
					{


						$branch_id = mysqli_real_escape_string($conn, $_POST['branch_id']);
						$institute_id = mysqli_real_escape_string($conn, $_POST['institute_id']);
						

						$res=mysqli_query($conn, "SELECT * FROM add_batch WHERE branch_id='$branch_id' && institute_id='$institute_id'");

						$product_count = mysqli_num_rows ($res);

						$course_id = $row['course_id'];
						if ($product_count > 0) {
                      
                      		
								
									while ($row=mysqli_fetch_array($res)) {


						
										?>

									<div class="col-md-6 col-sm-6">
	                        	<form method="POST" action="student.php?page=subscribecourse">
				                        <div class="card">
				                            <div class="panel-body">
				                            	
				                                <h3><?php echo $row['course_name']; ?></h3>

				                                <input type="hidden" name="student_name" value="<?php echo $s_name; ?>">
				                               <input type="hidden" name="institute_id" value="<?php echo $row['institute_id']; ?>">
				                               
				                               <input type="hidden" name="branch_id" value="<?php echo $row['branch_id']; ?>">
				                               
				                               <input type="hidden" name="batch_id" value="<?php echo $batch_id; ?>">
				                               
				                               <input type="hidden" name="course_id" value="<?php echo $course_id; ?>">
				                                 <input type="hidden" name="course_name" value="<?php echo $row['course_name']; ?>">

				                               <input type="hidden" name="student_id" value="<?php echo $s_id; ?>">
				                                <?php

				                                $res1=mysqli_query($conn, "SELECT * FROM assign_student WHERE branch_id='".$branch_id."'");
				                              #$row1=mysqli_fetch_array($res1);
				                               
				                                while ($row1=mysqli_fetch_array($res1)) {

				                               
				                                	if (($course_id == $row1['course_id']) && ($row1['status'] == 'Approved')) {
				                                		# code...
				                                		echo "<button class='btn-button default' type='submit' name='submit'>Taken</button>";
				                                	}
				                                	else
				                                	{
				                                		echo "<button class='btn-button default' type='submit' name='subscribe'>Not Taken</button>";
				                                	}
				                                	
				                               }

				                                ?>
				                              
				                                
				                                
				                           </div>
				                        </div>
				                         </form>
				                    </div>

									<?php

									}
									
								



                      }
                       else
                      {
                      	?>
                      		<div class="col-md-12 col-sm-12">
	                        	
		                        <div class="card">
		                            <div class="panel-body">
		                            	<h3>Sorry! No course found in this branch</h3>
		                            </div>
		                        </div>
		                    </div>
                      	<?php
                      }

					}
			                   
                    
                ?>
                </div>
                </div>
            
                <!-- end page content -->
                 
            </div>
            </div>
            <!-- end page content -->
          
        </div>
        <!-- end page container -->
        <!-- start footer -->  
        <?php include './footer.php';?>

解决方案

id=


_SESSION['id']; ?> <!DOCTYPE html> <html lang="en"> <!-- BEGIN HEAD --> <head> <?php include 'head.php';?> <head/> <!-- END HEAD --> <body class="page-header-fixed sidemenu-closed-hidelogo page-content-white page-md header-white white-sidebar-color logo-indigo"> <div class="page-wrapper"> <!-- start header --> <div class="page-header navbar navbar-fixed-top"> <?php include 'header.php';?> </div> <!-- end header --> <!-- start page container --> <div class="page-container"> <!-- start sidebar menu --> <?php include 'menu.php';?> <!-- end sidebar menu --> <!-- start page content --> <div class="page-content-wrapper"> <div class="page-content-wrapper"> <div class="page-content"> <div class="page-bar"> <?php include './breadcrumb.php';?> </div> <div class="row clearfix"> <?php if(isset(


_POST['submit'])) {


这篇关于如果状态被批准,则要创建已批准的按钮,否则将出现待处理按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆