Hello, i have a problem with a new project:
So, its a "ticketing" system, for a Bus transport company.
The image below is an admin page, and only the bus driver will have acces, so that he can issue a ticket.
The text below the image, is the passenger's available ammount, and its being fetched by the database passengers, from the field key money and its being passed to the text field with id #text1.
The 4 buttons at the bottom of the page are all ticket options,
1.20€(1st button - with ID #b1)
0.60€(2nd button - with ID #b2)
1.70€(3rd button - with ID #b3)
0.90€(4th button - with ID #b4)
I have made if statements, to disable a button, if the available ammount is not enough, that's why the 3d button is disabled.
The table on the right are passenger's old tickets.
The field near the box with the image, is a "topup" option.The input field , with ID #topup accepts only numeric input.
So my problem is that i can't find out how to add and substract money from the avaialble balance:
Once the admin clicks on a ticket button(e.g. if admin clicks button 1 - #b1, i need the available amount reduced by 1.20, so the value after the button is clicked should be 0.40 ), and then update the database for that change.
And finally, for the "topup", i wont integrate a payment system, it will be "cash", the passenger will give the money to the bus driver and he will just add the money.
So here i need the variable taken from the input field, being added to the available amount.So if 50 is the input, then the database value should be 51.60(50 plus the 1.60 from before).
I just can't find a way to do this...
i can calculate the fields to a variable, but i dont know how to update the database...
Can you please give me an example on one button how the code is done?