Title: redirect form request for options.php &#8211; edit data first
Last modified: August 19, 2016

---

# redirect form request for options.php – edit data first

 *  Resolved [fliebel](https://wordpress.org/support/users/fliebel/)
 * (@fliebel)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/redirect-form-request-for-optionsphp-edit-data-first/)
 * hi
 * i am writing a plugin for wordpress witch stores data in option fields.
    so i
   have a nice form that submits to options.php, works fine, no problem at all.
 * but i need to check and change some data first, before it is saved.
    for example,
   i have a email field split in to parts, one before the ‘@’ and one after it, 
   and i need php to make it one field and save it. or make a JSON string of something…
   or maybe make some thing all lowercase…
 * so my question is, how do i save option fields without js and forms, pure php.
   
   can i access them like set_option_field() or something? i tried this with curl:
 *     ```
       <?php
       ini_set('display_errors', 'On');
       error_reporting(E_ALL);
   
       if($_SERVER['REQUEST_METHOD'] === "POST") {
       	$url = "http://localhost:8888/michael/wordpress/wp-admin/options.php";
       	//$url = "http://localhost:8888/michael/wordpress/wp-content/plugins/programmering/test.php";
       	$ch = curl_init();
   
       	// set the target url
       	curl_setopt($ch, CURLOPT_URL,$url);
       	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
       	// howmany parameter to post
       	curl_setopt($ch, CURLOPT_POST, count($_POST));
   
       	$fields = "";
       	foreach($_POST as $key => $value) {
       		$fields .= $key ."=". $value ."&";
       	}
       	//echo $fields;
       	//echo "hoi";
   
       	curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
   
       	$result = curl_exec($ch);
       	curl_close($ch);
       	echo $result;
       } else die("hacking atempt!");
       ?>
       ```
   
 * but it does not work…

The topic ‘redirect form request for options.php – edit data first’ is closed to
new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [POST request](https://wordpress.org/support/topic-tag/post-request/)
 * [redirect](https://wordpress.org/support/topic-tag/redirect/)

 * 0 replies
 * 1 participant
 * Last reply from: [fliebel](https://wordpress.org/support/users/fliebel/)
 * Last activity: [17 years, 9 months ago](https://wordpress.org/support/topic/redirect-form-request-for-optionsphp-edit-data-first/)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
