Title: Saving data from an input
Last modified: September 1, 2016

---

# Saving data from an input

 *  [kjgbriggs](https://wordpress.org/support/users/kjgbriggs/)
 * (@kjgbriggs)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/saving-data-from-an-input/)
 * I am writing an options page for a plugin I am developing and am having huge 
   trouble saving any data from it.
 * I need to be able to access the information from several inputs in other php 
   files and scripts, but haven’t even been able to save the damn thing set.
 * I can’t use the settings API as it is too gerneric (doesn’t meet the layout requirements
   of the client), so I am having to handball everything.
 * In my main file, I have this:
 *     ```
       function LoadPress_Email() {
       	if ( !current_user_can( 'manage_options' ) )  {
       		wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
       	}
   
       	if (isset($_POST['fromValue'])) {
               update_option('fromValue', $_POST['fromValue']);
               $value = $_POST['fromValue'];
           } 
   
           $value = get_option('fromValue', 'Example');
   
       	include 'LoadPressOptions-Email.php';
       }
       ```
   
 * Which is called by an add_submenu_page call.
 * Inside the LoadPressOptions-Email.php file, I have this:
    `<input value="<?php
   echo $fromValue; ?>" style="height:40px;" type="text" id="fromValue" placeholder
   =""From" Text" class="emailInput" autocomplete="off" autocorrect="off" autocapitalize
   ="off" spellcheck="false">` and
 *     ```
       <?php
       		if (isset($_POST['fromValue'])) {
       			update_option('fromValue', $_POST['fromValue']);
       			$fromValue = $_POST['fromValue'];
       		}
       		$fromValue = get_option('fromValue');
       	?>
       ```
   
 * The actual file is over 200 lines long so I can’t exactly post that here, but
   this is the only bit of “functional” code I have in there (or should function
   anyway).
 * My understanding of this is that it should get the FromValue value and store 
   it…somewhere when the submit button is clicked, but it doesn’t seem to at all.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [cedcommerce](https://wordpress.org/support/users/cedcommerce/)
 * (@cedcommerce)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/saving-data-from-an-input/#post-7505835)
 * Hi kjgbriggs,
 * In the input html which you have used
 * `<input value="<?php echo $fromValue; ?>" style="height:40px;" type="text" id
   ="fromValue" placeholder=""From" Text" class="emailInput" autocomplete="off" 
   autocorrect="off" autocapitalize="off" spellcheck="false">`
 * add an attribute name = “fromValue” or replace the above input element by
 * `<input value="<?php echo $fromValue; ?>" style="height:40px;" type="text" name
   ="fromValue" id="fromValue" placeholder=""From" Text" class="emailInput" autocomplete
   ="off" autocorrect="off" autocapitalize="off" spellcheck="false">`
 * and hope everything will work fine.
 *  Thread Starter [kjgbriggs](https://wordpress.org/support/users/kjgbriggs/)
 * (@kjgbriggs)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/saving-data-from-an-input/#post-7505897)
 * Thanks for this.
 * Can I access these variables from outside that specific page or not? can’t seem
   to find any info on the dev docs.
 *  [cedcommerce](https://wordpress.org/support/users/cedcommerce/)
 * (@cedcommerce)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/saving-data-from-an-input/#post-7505996)
 * Yes, You can access these variables in theme’s functions.php file

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Saving data from an input’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [cedcommerce](https://wordpress.org/support/users/cedcommerce/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/saving-data-from-an-input/#post-7505996)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
