为href和PHP

时间:2018-10-28 08:47:09

标签: javascript php mysql

我是PHP的初学者。我有一张表,它值取mysql。 share有一个a href字段,我还有一个文本框..所以我只单击共享,我想同时获得两个值...但是我的代码无法正常工作。它只能在表的第一行工作。我只单击第二行,但不传递文本框值

在这里检查我的代码...

$attchquery= mysql_query("select * from eduploads order by id desc limit 5") ; echo "
<table style='width:100%' class='table'>" ; echo "
    <tr>" ; echo "
        <th>No</th>
        <th>Date</th>
        <th>File Name</th>
        <th>FileSize</th>
        <th>Attachemnt Code</th>
        <th>File Link</th>
        <th>Share</th>" ; echo "</tr>" ; $count = 0 ; while ($row = mysql_fetch_array($attchquery)) { $count++ ; echo "
    <tr>" ; echo "
        <td>",$count,"</td>
        <td>",$row['filedate'],"</td>
        <td>", $row['filename'].".".$row['fileext'],"
        </td>
        <td>", $row['filesize'],"
        </td>
        <td>",$row['fileid'],"</td>
        <td>", "
            <a href='".$valueres[' settingsvalue '],$row['filelink ']."'>Download</a></td>
        <td>", "
            <a id='the-link' href='?id=".$row[' fileaddname ']."' class='btn btn-primary'>Share</a>
        </td>" ; echo "</tr>" ; } echo "</table>" ; ?>
<form>
    <input type="text" name="singleemail" id="singleemail" value="testvaluepossing">
</form>
<script>
    document.getElementById('the-link').onclick = function(e) {
        var singleemail = document.getElementById('singleemail').value;
        document.location.href = this.href + '&singleemail=' + singleemail;
        e.preventDefault();
        return false;
    }
</script>

这是如何工作的?请提供良好的解决方案或示例。

0 个答案:

没有答案