PHP URL链接变量


PHP URL link variable

我有以下问题。

我做了一段时间的mysql_fetch_arry函数来从表中获取值。

我希望在每一行的末尾都有一个文本字段(金额)和一个按钮(添加)。

代码如下:

<?php while($info = mysql_fetch_array( $data )): ?>
<td id="articlenr" class="width1left"><a href="www.google.de'<?php echo $info['articlenr'] ?>"><?php echo $info['articlenr'] ?> </a></td>
<td class="width2center"><?php echo $info['stock']. " / " .$info['minstock'] ?></td>
<?php endwhile ?>

第二行是文章的细节,什么是有效的。

我如何制作一个函数,在按钮和每行的文本字段上执行onclick Event?

点击按钮应该发生:

  1. 从文本字段"获取值";金额";(此行)和Articlenr(此行)
  2. 建立一个"……"的链接;。。。。''add.php?article=articlener(来自此行)&ammunt=ammunt(来自此行)
  3. 打开一个新窗口
<?php while($info = mysql_fetch_array( $data )): ?>
<td class="width1left"><a href="www.google.de'<?php echo $info['articlenr'] ?>"><?php echo $info['articlenr'] ?> </a></td>
<td class="width2center"><?php echo $info['stock']. " / " .$info['minstock'] ?></td>
<td><input type="text" id="amount<?php echo $info['articlenr'] >?"></td>
<td><input typ="button" value="add" onclick="openWindow('<?php echo $info['articlenr'] ?>');"></td>
<?php endwhile ?>
<script>
function openWindow(articlenr) {
    var amount = document.getElementById('amount'+articlenr).value;
    var url = ".../add.php?article="+articlenr+"&ammount="+amount;
    window.open(url);
}
</script>