Is there a simple way to copy form data using Javascript into PHP variables so that I can add them to my database? The reason I'm doing it this way because the form will already have on function which redirects a user to paypal to pay. I don't want multiple buttons so I'm using Javascript to copy the form data into php. the submit button will then save the javascript/php content into the database as well as take the user to paypal to pay.
JavaScript to PHP
Page 1 of 11 Replies - 347 Views - Last Post: 19 July 2011 - 05:30 PM
Replies To: JavaScript to PHP
#2
Re: JavaScript to PHP
Posted 19 July 2011 - 05:30 PM
Take a look at using PHP with JSON (And AJAX). (There's an entire api online)
In Javascript, we can pull the values out of a form via your preferred method. I like jQuery myself. something like:
And then handle it from the POST data over on the PHP side =)
In Javascript, we can pull the values out of a form via your preferred method. I like jQuery myself. something like:
var data = $('#my-form').serialize();
$.ajax({
type: 'POST',
url: '/path/to/file.php',
data: data
});
And then handle it from the POST data over on the PHP side =)
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote




|