this code didn’t in wp template form custom plugin

<?php }
//If upload button is clicked …

function get_data(){
if (isset($_POST[‘upload’])) {
$fil = $_FILES[‘file’][‘name’];
$nam = $_POST[‘tx’];
$nam2 = $_POST[‘tx2’];
global $wpdb;
$tablename=$wpdb->prefix.”newtbl”;
$uplod = ‘qualwebs/img/’;
($_FILES[“file”][“name”]);

$upd = plugin_dir_url( dirname( __FILE__ ) ) . $uplod;
$wpdb->insert( $tablename,
array(‘post_id’ => $fil,
‘user_id’ => $nam,
‘url’ => $upd,
‘rating_value’ => $nam2
),array(
‘%s’,
‘%s’,
‘%s’,
‘%s’
)
);

$result = $wpdb->get_results ( “SELECT * FROM wp_newtbl” );

foreach ( $result as $print ) {
?>
<tr>
<strong>Name:</strong><td><?php echo $print->user_id;?></td><br>
<strong>Last name:</strong><td><?php echo $print->rating_value;?></td><br>
<strong>Img name:</strong><td><?php echo $print->post_id;?></td><br>
<strong>url:</strong><td><?php echo $print->url;?></td><br>
</tr>
<?php } }
}

add_shortcode( ‘DATA’, ‘get_data’ );
?>

Read more here:: this code didn’t in wp template form custom plugin

Leave a Reply

Your email address will not be published. Required fields are marked *