Home > OS >  How to get $_GET to use the value you want?
How to get $_GET to use the value you want?

Time:10-08

just working on an extra work project for school and have hit a wall.

I am trying to calculate tax based on province in a simple order form using $_GET.

It seems like it always uses the value right after 'province' although I'm trying to tell it to use to corresponding tax rate $taxrate.

php file

.php file

html file

.html file

CodePudding user response:

Line number 19 getting the province value. That is your problem.

Just simplt get rid of $taxrate = $_GET['province']; will fix your issue.

To prevent future error. I recommend you add: $taxrate = "0.05" on your code line number 4 as default value of your $taxrate.

  • Related