| | #1 |
| HyperActive Warrior Join Date: 2010 Location: Canada
Posts: 114
Thanks: 0
Thanked 1 Time in 1 Post
|
I don't know why the code and php tags are messing up the code pasted. So here here the raw code. Say I have this code. $percent = $_POST['percent']; $old_price = $_POST['old_price']; $discount_value = ($old_price / 100) * $percent; $new_price = $old_price - $discount_value; <form method="post" action="" enctype="multipart/form-data"> old Price : <input type="number" name="old_price" min="1" max="5" value="<?php echo $percent; ?>"><br> percent off : <input type="number" name="percent" min="1" max="3" value="<?php echo $old_price; ?>"><br> new price : <input type="number" name="new_price" min="1" max="5" value=" "><br> <input type="submit" id="submit" value="submit"> </form> How do I make it so that the new_price field automatically updates after I input the old_price field and percent field? |
| | |
| |
| | #2 |
| WHat u SEe mAy bE aN ...? Join Date: 2014 Location: hell
Posts: 34
Thanks: 0
Thanked 1 Time in 1 Post
|
Fix the line 3 $discount_value = ($old_price * $percent)/100 ; Hope it help |
|
If you are looking for a pro windows programmer then email me to : superbtheftauto@gmail.com | |
| |
| | #3 |
| WHat u SEe mAy bE aN ...? Join Date: 2014 Location: hell
Posts: 34
Thanks: 0
Thanked 1 Time in 1 Post
|
Try using ajax there are lot'S of tuts out there |
|
If you are looking for a pro windows programmer then email me to : superbtheftauto@gmail.com Last edited on 22nd Feb 2014 at 08:12 PM. Reason: wrong info | |
| |
| | #4 |
| HyperActive Warrior Join Date: 2010 Location: Canada
Posts: 114
Thanks: 0
Thanked 1 Time in 1 Post
|
Thanks for that edit. I am searching for ajax tut that does that. If you know where the one i need located, kindly point them to me. Thanks. |
| | |
| |
| | #5 |
| HyperActive Warrior Join Date: 2010 Location: Canada
Posts: 114
Thanks: 0
Thanked 1 Time in 1 Post
|
Found a way to do this function in ajax. It's all good now.
|
| | |
| |
|
| Bookmarks |
| Tags |
| calculate, discount, percentage |
| |