I want to pass both stock (user input) and id in one url one I try this I get Undefined index: stock
is the way I'm passing the input value wrong ?
<?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>";
}
?>
thank you everyone for your help this is what I did to fix the error my get value is always empty If I don't press enter
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>";
}