我想将两个股票(用户输入)和id传递给一个网址我试试这个未定义索引:股票
是我传递输入值错误的方式?
<?php
session_start();
$sql1 = "SELECT * FROM tbl_customers WHERE customers_id='1'";
$sql = "SELECT * FROM tbl_products";
$get = mysqli_query($conn, $sql1) or die(mysqli_error($conn));
$row = mysqli_fetch_array($get);
$customerName = $row['customer_email'];
echo "Welcome $customerName";
$data= mysqli_query($conn, $sql) or die(mysqli_error($conn));
while ($row = mysqli_fetch_assoc($data)) {
$pid = $row['pid'];
echo "<form action='' method='GET'>
<input type=text name=stock value=1><br>
<a href='stock.php?id=" . $pid . "?stock=" . $_GET['stock'] . "'> Add</a>
</form>";
}
?>
谢谢大家的帮助,这就是我所做的修复错误我的获取值总是空的如果我不按回车
echo "<form action='' method='GET'>
<input type=text name=stock value=1><br>
</form>";
$_GET['stock'] = 1;
if (isset($_GET["stock"])) {
$x = $_GET['stock'];
echo "<a href='stock.php?id=" . $pid . "&stock=" . $_GET['stock'] . "'> Add</a>";
}
答案 0 :(得分:0)
只是改变?与&amp;在股票之前。
echo "<form action='' method='GET'><input type=text name=stock value=1><br>
<a href='stock.php?id=" . $pid . "&stock=" . $_GET['stock'] . "'> Add</a> </form>";
答案 1 :(得分:0)
<a href="/php/event-detail.php?event_id=$event_id">
这是您如何使用将值传递到另一个页面。你可以参考这个http://w3schools.invisionzone.com/index.php?showtopic=48611