php - insert data in a wordpress database -


i'm developing wordpress plugin responsible getting data external html form , inserts in database. form code is:

    <html>    <body>     <form action = "http://wp.istic.online/wp-content/plugins/news-apps/index.php" method = "post">          name: <input type = "text" name = "name" />           <input type = "submit" />       </form>     </body> </html> 

my plugin code is:

    <?php 

register($_post['name']); register($_post['name']);

function register($name) {      global $wpdb; $wpdb->insert(     'gcm_tokens',     array(         'token' => $name     ),     array(         '%s'     ) );  } 

the data not inserted when try echo $name variable works perfectly. when try echo after insert function it's not working.

any please?

use wp_nonce_field() below

<form> /* code */ <input type="hidden" name="action" value="new_post" /> <?php wp_nonce_field( 'new-post' ); ?>  </form> 

Comments

Post a Comment

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -