Problem accessing php variables onsubmit
I am constructing a webpage page that allows commercial fishermen to transfer their individual quota to another fisherman. I have used dw8, on a server using mysql. The page I am having problems with has an insert data form that the fisherman completes. When submitted this form adds this record to a table storing such transactions. At the same time, the amount of quota transferred is subtracted from fisherman #1's account and added to fisherman #2's account. This all works well. However, I wish to add a verification onsubmit that would check fisherman #1's account balance to ensure that he has sufficient quota prior to the transfer. If not the transfer would not occur. Currently, the site will allow a deficit to occur. This is not a good way to do business.
I have approached this by attempting to obtain two pieces of information (in addition to identifiers). One is the current transfer amount which would come from the current form. I have used $quotapounds = $_post[quotapounds] to obtain this piece. And fishermen #1's current balance, which I have obtained from the database using a select command. I have determined that both of these pieces of data are actually there by substituting them in commands that modify data tables.
My problem is that to have this verification occur client side I need to get them into javascript to be used in a function that can be called onsubmit. The have tried lines such as: quotapounds = <?php echo $quotapounds ?>, but I do not seem to be obtaining any values. My goal is to use these two variables in an if statement where If (balance - quotapounds) < 0 then an alert would pop-up informing the fisherman that he does not have enough quota to make the transaction.
Can anyone make some helpful suggestion on how I should be doing this?
