I am working on a simple php html code that get products information from the database, each product has a submit button and its value must be the id of the product like this:
<input type="submit" name="productId" value="' .$row['produc_id'] . '" />
and in the next page I can know the product id that the user choose using this:
$productId = $_POST['productId'];
the code above will works fine, but the problem is that I can't put any text in the submit buttons, text like buy or add to cart and all the submit buttons has a numbers value which is the id of the products.
I tried this code but it didn't work:
<input type="submit" value=" buy " />
<input type="hidden" name="productId" value="' .$row['produc_id'] . '" />