In the custom table, I try to update a specific column with using $wpdb->update class and using HTML form for updating one column that has same id (in here dlname Is ID of data ).
The problem is this When I trying to update the column in my table using HTML form The page only will Refresh
BUT When I manually set ID in codes and THEN typing and submitting new value by HTML form it will work like charm.
It seems to be machine cannot understand the value that inputted from the form This is my code :
<?php
if(isset($_POST['btnUpdate'])){
global $wpdb;
$table_name='wp_AR_tb_name';
$data_array = array(
'dstatus' => $_POST['dstatuschange'],
'downloadname' => $_POST['dlname'],
);
$data_where = array('downloadname' =>'dlname');
$wpdb->update($table_name,$data_array,$data_where);
}
And this is my Form :
<form method="POST">
<label> Input One : </label>
<input type="text" name="dlname"/>
<label> Input Two : </label>
<input type="text" name="dstatuschange" />
<button type="submit" name="btnUpdate"> Submit </button>
</form>
dlname
in db? codex.wordpress.org/Class_Reference/wpdb#UPDATE_rows may help. Pay attension toformat
andwhere_format
.