drh96824 2017-03-28 19:13
浏览 28

输出已定义的值来自mysql和php的数据

<form action="begin.php" method="post" target="_blank">
    <input name="FName" type="hidden" value="download1.zip"><br>
    <input name="FSize" type="hidden" value="120 MB"><br>
    <input name="FSID" type="hidden" value="1292.168.1.1"><p></p>
    <div align="center">
        <input alt="Download" height="" src="download.png" type="image" width="225">
    </div>
</form>

value="download1.zip" I have created three rows in a table. FName, FSize, FSID and inserted data already!

Now in index.php where im using the download button form. When user clicks on it, it redirects to begin.php where user can download file = download1.zip and it should echo the file.

echo "Link : <a href = begin.php?key_id=".$key_id.">begin.php?key_id=".$key_id."</a><br>"; //Echoing unique link valid for single download.

There problem remains..! because if i wanna create multi forms with different values manually and then it should redirect to begin.php and downloads that another value file! and i wanna keep download like in serverside because i don't my users to have a direct link.

Right now i put that in begin.php which is not working.. i just dont wanna show that data the download link should be working! it should something like this. $link = "example.com/" and important thing is and another important thing is! if i add more rows in database begin.php should download that file from which

<?php
include "db.php";

              // Check connection
    if($dbCon === false){
        die("dbCon: Could not connect. " . mysqli_connect_error());
    }

    $sql = "SELECT id, FName, FSize, FSID FROM file";

    $result = $dbCon->query($sql);

    if ($result->num_rows > 0) {
                        echo "
                        <table class=\"table table-striped\">
                        <tr>
                        <th>ID</th>
                        <th>File Name</th>
                        <th>File Size</th>
                        <th>File ID</th>
                        </tr>";
                        // output data of each row
                        while($row = $result->fetch_assoc()) {
                            echo "<tr>
                            <td>".$row["id"]."</td>
                            <td>".$row["FName"]."</td>
                            <td>".$row['FSize']."</td>
                            <td>".$row['FSID']."</td>
                            </tr>";
                        }
                        echo "</table>";
                    } else {
                        echo "0 results";
                    }
                    $dbCon->close();
    ?>
  • 写回答

0条回答 默认 最新

    报告相同问题?