douxianglu4370 2015-08-24 19:17
浏览 14

在php中回发获取表格单元格值

I have table having two columns where each row contains column value and show button. When I click on show button on that row, value from that row will be visible. Once I get that value, I have to pass that value to stored procedure and get other value as well. Please help me.below is my php code :

 <?php  
//$a = $_POST['findSchool'];
if(isset($_POST['findSchool'])){
 $_SESSION['a'] = $_POST['findSchool'];
}
$a = $_SESSION['a'];

 //1. Enter DB credentials
$servername = "****";
$username = "****";
$password = "****";
$dbname = "****";
$flag = 0;

// 2.Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
echo '<form id="myNewForm" name="myNewForm" class="form"  method="post" action="">';
echo '<table class="table table-bordered">';
echo '<tr scope="col" >
                   <th align="center">SchoolName</th> 
                      <th align="center">Details</th>                
                  </tr>';
$sql = "SELECT schName FROM schoolinformation WHERE schName LIKE '%$a%'";
$i = 0;
$result = mysqli_query($conn, $sql);
while($rowval = mysqli_fetch_array($result))
{
$schName= $rowval['schName'];
echo '<tr scope="col"><td  align="center">'.$schName.'</td>
                   <td align="center"><input type="submit" id="shwData" name="shwData" class="btn" value="Show"/></td>';
}
echo '</table>';
echo '</form>';

if($schName == '')
{echo "Entry not found";
$flag = 1;}
else{
//echo $schName;
$flag = 0;}
?>  


<?php
if(isset($_POST['shwData']))
{
echo $schName;
echo "this is it";
}
?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统