Setting values on the server Site
Setting values on the server Site
From searching the forum it is my understanding that values can be passed to server side using the following code:
if(isset($_POST['action']) && ($_POST['action'] === 'create' || $_POST['action'] === 'edit')){
$salt = make_salt();
$password = make_random_password();
$a = array('cost' => 12, 'salt' => $salt);
$hash = password_hash($password, PASSWORD_BCRYPT, $a);
if($data['row']['users']['create_reset_password'] == 'YES'){
$data['row']['users']['salt'] = $salt;
$data['row']['users']['hash'] = $hash;
}
}
I have used to print_r to prove that $data['row'] has values. When I check the database I am not seeing any vales. What am I doing wrong?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I'm a little confused I'm afraid - if you want to pass extra values from the client-side, as your first line suggests, you would use
ajax.data
.If you want to format the sent data, which the code looks like, then you could use the
setFormater()
method for the PHP classes.Alternatively, the code you have above looks like it would probably work - as long as it is run before the
process()
method of course, but without being able to see the full code, I'm not certain.Allan
Allan
Ok. Here is the full code:
You need to modify the data before you call the
process()
method. Otherwise it is processing the unmodified data!Allan
Ok. Found this in the forum:
http://datatables.net/forums/discussion/23321/editor-i-need-to-be-insert-now-in-sql-database . It helped resolved issue.