Combine a Table + Form


@SaranacLake here is the code used if you need to see what I did:


if(isset($_SESSION['plan'])) {
    echo '<p>Current Stored Session Data</p><p>';
    echo '</p>';

$products = [
	'Plan A' => [
		'name' => 'Basic Plan',
		'cost' => 10,
	'Plan B' => [
		'name' => 'Standard Plan',
		'cost' => 20,
	'Plan C' => [
		'name' => 'Basic Plan',
		'cost' => 50,

        $_SESSION['plan'] = $_POST['plan'];
         echo "You chose,\n Our {$products[$_POST['plan']]['name']} and that costs \${$products[$_POST['plan']]['cost']}";
    if(isset($_SESSION['plan'])) {
        echo '<p>After the last request Session Data</p><p>';
        echo '</p>';

<!doctype html>
        <form method='post'>
                    <td><input type='submit' name='plan' value='Plan A'></td>
                    <td><input type='submit' name='plan' value='Plan B'></td>
                    <td><input type='submit' name='plan' value='Plan C'></td>
                    <td>Free stuff</td>
                    <td>Account Access</td>


I am looking at the HTML now.

Thanks for the PHP code as well.

I know all of this seems very basic to someone like you, but when you haven’t done this in several years it seems hunormous!

I look forward to when I get my site up and then I can go back and study up on PHP, HTML, CSS from scrtahc. (And maybe even finally learn Javascript?!)

Thanks again!! :+1:



How do I get your example to work if all of my buttons are called “Select”?

For example…

<td><input type='submit' name='silver' value='Select'></td>
<td><input type='submit' name='gold' value='Select'></td>
<td><input type='submit' name='platinum' value='Select'></td>


Use an image for the button.


Is that my only option?

Can I use a hidden value?


How would you set the hidden value? If you do a separate submit button altogether, you could use radio buttons and make them look like a normal button.


You can submit a hidden value with a traditional form. But since I have 3 submit buttons, I don’t see how to map a hidden value to the button selected.

I actually started a new thread related to this…