I am rying to modify a free maillist script. trying to add name + country fields. in php file (inserts to DB) // Connect to database $con = mysql_connect(DBHOST ,DBUSER, DBPASS); mysql_select_db(DBNAME, $con); // Insert email address into mailinglist table $result = mysql_query("INSERT INTO mailinglist SET email='" . $address . "'"); if(mysql_error()){ $message = "<strong>Error</strong>: There was an error storing your email address."; } else { $message = "Thanks for signing up!"; } PHP: and in js file function storeAddress(e) { // Update user interface $('response').innerHTML = 'Adding email address...'; // Prepare query string and send AJAX request var pars = 'address=' + escape($F('address')) ; var myAjax = new Ajax.Updater('response', 'ajaxServer.php', {method: 'get', parameters: pars}); // Stop form from submitting when JavaScript is enabled Event.stop(e); } Code (markup): I need to add $name and $country fields. I tried , but couldnt.. (I have already added them to mysql table, also form field) Thanks
I'm not sure what libraries you use, I would try changing 1 line in the php part and 1 line in js one. Here it goes. php: $result = mysql_query("INSERT INTO mailinglist SET email='" . $address . "', name='" . $name . "', country='" . $country); PHP: js: var pars = 'address=' + escape($F('address')) + '&name=' + escape($F('name')) + '&country=' + escape($F('country')) ; Code (markup):