I have a list of names and some buttons with product names. When one of the buttons is clicked the information of the list is sent to a PHP script, but I can't hit the submit button to send its value. How is it done? I boiled my code down to the following:
The sending page:
<html> <form action="buy.php" method="post"> <select name="name"> <option>John</option> <option>Henry</option> <select> <input id='submit' type='submit' name='Tea' value='Tea'> <input id='submit' type='submit' name='Coffee' value='Coffee'> </form> </html> The receiving page: buy.php
<?php $name = $_POST['name']; $purchase = $_POST['submit']; //here some SQL database magic happens ?> Everything except sending the submit button value works flawlessly.
checkboxinstead!isset($_POST['submit'])evaluates to false.id="submit"id has a unique value, but in your case you are replicatingid="submit"twicename = 'tea'is incorrect syntax. Tryname='tea'without the spaces.