title: Help Writing Input Data to Database With Wordpress Plugin
body: <p>Hi I am making a wordpress plugin where I need the Admin to enter data into a database table. I am able to install the db table when the Plugin is activated, however I can't figure out how to save the user input. I've asked on the WP forums but they're dead... Any experienced guru who can lend some guidance would be greatly appreciated.</p>
  
  <pre><code>&lt;?php
  
  
  
  /*******************************************************************
  *           INSTALL DB TABLE - ONLY AT RUN TIME                    *
  *******************************************************************/
  function ed_xml_install() {
  global $wpdb;
  
  $ed_xml_data = $wpdb-&gt;prefix . "ed_xml_data";
  if($wpdb-&gt;get_var("SHOW TABLES LIKE '$ed_xml_data'") != $ed_xml_data) {
  
  $sql = "CREATE TABLE " . ed_xml_data . " (
    id mediumint(9) NOT NULL AUTO_INCREMENT,
    name tinytext NOT NULL,
    address text NOT NULL,
    url VARCHAR(55) NOT NULL,
    phone bigint(11) DEFAULT '0' NOT NULL,
    UNIQUE KEY id (id)
  );";
  
    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    dbDelta($sql);
  
    $name = "Example Business Name";
    $address = "1234 Example Street";
    $url = "http://www.google.com";
    $phone = "523-3232-323232";
  
    $insert = "INSERT INTO " . ed_xml_data .
          " (phone, name, address, url) " .
          "VALUES ('" . phone() . "','" . $wpdb-&gt;escape($name) . "','" . $wpdb-&gt;escape($address) . "', '"  . $wpdb-&gt;escape($url) . "')";
  
    $results = $wpdb-&gt;query( $insert );
  }
  }
  
  //call the install hook
  register_activation_hook(__FILE__,'ed_xml_install');
  
  /*******************************************************************
  *           CREATE MENU, CREATE MENU CONTENT                       *
  *******************************************************************/
  if ( is_admin() ){
  
  /* place it under the ED menu */
  //TODO $allowed_group = '';
  
  /* Call the html code */
  add_action('admin_menu', 'ed_xmlcreator_admin_menu');
  
  function ed_xmlcreator_admin_menu() {
  add_options_page('ED XML Creator', 'ED XML Creator', 'administrator', 
  'ed_xml_creator',  'ed_xmlcreator_html_page');
  }
  }
  
  /*******************************************************************
  *           CONTENT OF MENU CONTENT                                *
  *******************************************************************/
  
  
  function ed_xmlcreator_html_page() {
  &lt;div&gt;
  &lt;h2&gt;Editors Deal XML Options&lt;/h2&gt;
  &lt;p&gt;Fill in the below information which will get passed to the .XML file.&lt;/p&gt;
  &lt;p&gt;[&lt;a href="" title="view XML file"&gt;view XML file&lt;/a&gt;]&lt;/p&gt;
  
  &lt;form method="post" action="options.php"&gt;
  &lt;?php wp_nonce_field('update-options'); ?&gt;
  
  &lt;table width="510"&gt;
  &lt;!-- title --&gt;
  &lt;tr valign="top"&gt;
  &lt;th width="92" scope="row"&gt;Deal URL&lt;/th&gt;
  &lt;td width="406"&gt;
  &lt;input name="url" type="text" id="url"
  value="&lt;?php echo get_option('url'); ?&gt;" /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;!-- description --&gt;
  &lt;tr valign="top"&gt;
  &lt;th width="92" scope="row"&gt;Deal Address&lt;/th&gt;
  &lt;td width="406"&gt;
  &lt;input name="address" type="text" id="address"
  value="&lt;?php echo get_option('address'); ?&gt;" /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;!-- business name --&gt;
  &lt;tr valign="top"&gt;
  &lt;th width="92" scope="row"&gt;Business Phone&lt;/th&gt;
  &lt;td width="406"&gt;
  &lt;input name="phone" type="text" id="phone"
  value="&lt;?php echo get_option('phone'); ?&gt;" /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;!-- address --&gt;
  &lt;tr valign="top"&gt;
  &lt;th width="92" scope="row"&gt;Business Name&lt;/th&gt;
  &lt;td width="406"&gt;
  &lt;input name="name" type="text" id="name"
  value="&lt;?php echo get_option('name'); ?&gt;" /&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  
  &lt;input type="hidden" name="action" value="update" /&gt;
  &lt;input type="hidden" name="page_options" value="hello_world_data" /&gt;
  
  &lt;p&gt;
  &lt;input type="submit" value="&lt;?php _e('Save Changes') ?&gt;" /&gt;
  &lt;/p&gt;
  
  &lt;/form&gt;
  &lt;/div&gt;
  
  ?&gt;
  </code></pre>