Title: add something to database code
Last modified: August 20, 2016

---

# add something to database code

 *  [Freddie Aziz Jasbindar](https://wordpress.org/support/users/kakinetwork/)
 * (@kakinetwork)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/add-something-to-database-code/)
 * can someone help me fix this code?
 *     ```
       <?php
       /*
       Plugin Name: test
       Description: testing
       Version: 1.0.2
       */
       if ( is_admin() ){
       	add_action('admin_menu', 'kn_mp3_admin_menu');
       		function kn_mp3_admin_menu() {
       			add_menu_page('Search', 'Search', 'administrator', 'kn_mp3', 'kn_mp3_html_page', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)).'images/kaki.png');
       			}
       }
       function kn_mp3_html_page() {
       ?>
       <form method="post">
       	<input type="text" size="100" name="text" value="<? echo get_option('text'); ?>" />
       	<p class="submit"><input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /></p></td>
       </form>
       <?php
       }
       ?>
       <?php
       global $kn_mp3;
       $kn_mp3 = "1.0.2";
       //install database kn mp3
       function kn_mp3_install() {
          global $wpdb;
          global $kn_mp3;
   
          $table_name = $wpdb->prefix . "kn_mp3";
   
          $sql = "CREATE TABLE " . $table_name . " (
       	  id mediumint(9) NOT NULL AUTO_INCREMENT,
       	  time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
       	  name tinytext NOT NULL,
       	  text text NOT NULL,
       	  url VARCHAR(55) DEFAULT '' NOT NULL,
       	  UNIQUE KEY id (id)
           );";
   
          require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
          dbDelta($sql);
   
          add_option("kn_mp3", $kn_mp3);
       }
   
       register_activation_hook(__FILE__,'kn_mp3_install');
       ?>
       ```
   
 * I try to make submit button works.. save the date to the database that created..
 * admin page : wp-admin/admin.php?page=kn_mp3

The topic ‘add something to database code’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [Freddie Aziz Jasbindar](https://wordpress.org/support/users/kakinetwork/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/add-something-to-database-code/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
