PHP variable depending on HTML input


I’m building a very simple calculator with PHP and HTML. Basically I want the user to put their state in and hit submit and when they do that, depending on the first letter I want it to generate what the total will be with the tax now added. What’s the best way to do this?

Here is what I have so far:


$task = [
    'subtotal' => '$198.38',
    'tax' => 'tbd',
    'shipping' => '$5.00',
    'grand_total' => false


require 'index.view.php';


<h1> Detailed Cost Breakdown</h1>
            <input name="state" placeholder="Enter Your State"> <button>Submit</button>
                        <strong>Subtotal: </strong> <?=$task['subtotal']; ?>

                        <strong>Tax: </strong> <?=$task['tax']; ?>

                        <strong>Shipping: </strong> <?=$task['shipping']; ?>

                        <strong>Grand Total: </strong>
Solus90 1 month 0 Answers 7 views 0

Leave an answer