PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hello, I have this form on my html page, to send the value to paypal. I would like to change the amount value using php when someone enters a number in a textbox and click a button. If anyone could please explain to me the procedure. I have doen it using javascript, but it was not browser compatible.
The only way you can do this with PHP is to submit the form fully to replace the value in the code and then submit the paypal form from there. You could do this by automatic redirect using javascript.
illuminationed wrote:I suggest you go to Php.net and look up the $_POST function -
It is very useful
$_POST is not a function and I don't think that knowing to use POST variables alone would be particularly useful here since the form needs to go to PayPal.
Your form has only hidden attributes!!!, what is the way that user changes the amount value? If through another form, put a onClick="myFunction()" to your other form's submit button; where myFunction() is a javascript function.
benArfika wrote:I have doen it using javascript, but it was not browser compatible.
Since PHP is the server-side scripting and Javascript is the client-side scripting, using Javascript is prettier than using PHP. If you must it using PHP then, you have to send the data to the server one more time.
MilchstrabeStern wrote:I disagree, I think PHP is a perfect option for this. Javascript has a lot of.. maybe I just hate javascript lol.
Dont let your prejudices own you. PHP and Javascript are different things. One of them is working on the server-machine and another is working on the clients-machine. There is no need to hate it.
You can hate ASP, and use PHP4 or you can hate ASP.NET and use PHP5. Instead of hating javascript, you should combine it with PHP to get excellent web-applications.