Codes for updating database in php
Here's an example of the data from a sample form: https:// To prevent possible SQL injection vulnerabilities to your database, we'll need to run PHP's addslash() function for every post variable.And since the $_POST data is an array, let's make a function that will loop on every variable: To check if an insert or an update should be done, a search should be initialized if the submission ID exists and then set a condition that if the submission ID exists, an update should be initialized using that submission ID.I don't know what do you mean by "sanitize or use prepared statements"?The field name in db I wanting to update is called "approval_status", and the table name name is "webform_submitted_data", the dropdown box is called "apprrovalstat" ...my update query it looks like this..sure whether is right..looks like it should work: mysql_query("UPDATE webform_submitted_data SET approval_status = $dropdown"); Would you mind please put this information into syntax...The data being posted by Jot Form is actually an array so to find out the array keys and values, you will have to try to insert this in your script: Do an actual submission to test your form and get the result.Once you have submitted the form, it should be redirected to your custom thank-you URL that will receive the post data.
I'm trying to find out how to call a function for submit button.
@Star Lion: I will definitely had a closer look into PHP once I'm done with this project Cheers guys Thanks Steve. What happens when you have a project with nid 11, and sid 1, and another with nid 1, and sid 11? If NID and SID are a unique identifier (duple), they should be the key. Your form has no way of identifying which project you're trying to modify. mysql_real_escape_string($_POST['apprrovalstat']) ."' WHERE nid = ".intval($_POST['nid'])." AND sid = ".intval($_POST['sid'])); echo "Rows updated"; Notes here:1: i've shifted the "is not -select-" check into the IF.