簡體   English   中英

單擊MySql表的特定行,這樣它將自動創建一個新文件,該文件在PHP網頁中具有該行的數據

[英]Click on a particular row of MySql Table, such that it automatically creates a new file having data of that row in a PHP Web Page

我只想單擊一行,這樣它會自動創建一個具有該特定行數據的新文件,並且該文件也應自動下載。 請幫我做到這一點。

<html>
<head>
<title>Click on Particular Row fo MySql Table, then Create New File having data of that Row in PHP</title>
</head>
<body>
 <table  class="table table-striped table-hover" border="1" id="dataTable1" style="text-align: justify;margin-left:30px;">
          <tr class="success" style="border-bottom: solid;border-top: solid;">
                            <th>
                                I.D.
                            </th>
                            <th>
                             Date
                            </th>
                            <th>
                            Website
                              </th>
                            <th>
                                 E-Mail
                            </th>
                            <th>
                                Mobile&nbsp;Number(Head)
                            </th>                           
                            <th>
                            Courses
                            </th>
                                 <th>
                                File
                            </th>
                </tr>
                           <?php
                           while($row = mysqli_fetch_array($fetch))
                             {
                            ?>
                           <tr>
                               <td>
                                   <a href="Perticular.php?<?php echo $row['id']; ?>" target="_blank"><?php echo $row['id'];?></a> <!-- Want to Click on I.D. Such that Automatically Create New File having data of this whole Row -->
                               </td>
                               <td>
                                   <?php echo $row['date_Time'];?>
                               </td>                               
                               <td>
                                   <a href="<?php echo "http://".$row['website']; ?>" target="_blank"><?php echo $row['web_link'];?></a>  
                               </td>

                               <td>
                                  <?php echo $row['e_mail']; ?>
                               </td>

                               <td>
                                   <?php echo $row['mobile_number']; ?>
                               </td>
                               <td>
                                   <?php echo $row['courses_offer']; ?>
                               </td>

                               <td>
                                   <a href="uploaded/<?php echo $row['file_Attach'];?>" target="_blank">View File</a>
                               </td>
                           </tr>
                           <?php
                             }
                           ?>
                    </table>

</body>
</html>

hidden input中包含所需的信息,或創建一個頁面,該頁面的行ID為$_GET值,運行查詢並輸出信息。

Onclick ,使用iframehidden pop-up div 該頁面從$_GET獲取ID /值,如果需要,運行查詢, file_put_contents($file, $data)將數據輸出到文本文件。 具有下載鏈接/圖像以下載文件,指向剛剛創建的文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM