Skip to content
Advertisement

Send value of submit button when form gets posted

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:

JavaScript

The receiving page: buy.php

JavaScript

Everything except sending the submit button value works flawlessly.

Advertisement

Answer

The button names are not submit, so the php $_POST['submit'] value is not set. As in isset($_POST['submit']) evaluates to false.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement