Title: What went wrong? my plugin
Last modified: August 19, 2016

---

# What went wrong? my plugin

 *  [m1234x5](https://wordpress.org/support/users/m1234x5/)
 * (@m1234x5)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/what-went-wrong-my-plugin/)
 *     ```
       <?php
       /*
       Plugin Name:My Plugin
       */
   
       function my_function($text){
       	if(isset($_POST["name"])) {
       		$name = $_POST['name'];
       	} else {
       		echo "
       			<form method='post' action='options.php'>
       			name : <inputtype='text' name='name'>
       			<input type='submit' value='submit'>
       			</form>
       		";
       	}
   
       	$text = str_replace('foo',$name,$text); //replace $name -> foo
       	return $text;
       }
   
       add_filter('the_content','my_function');
       ?>
       ```
   

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

 *  [webjunk](https://wordpress.org/support/users/webjunk/)
 * (@webjunk)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/what-went-wrong-my-plugin/#post-1788736)
 * From a quick look I see:
    inputtype=’text’ which needs a space like: input type
   =’text’
 *  Thread Starter [m1234x5](https://wordpress.org/support/users/m1234x5/)
 * (@m1234x5)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/what-went-wrong-my-plugin/#post-1788740)
 *     ```
       <?php
       /*
       Plugin Name:My Plugin
       */
   
       function my_function($text){
       	if(isset($_POST["name"])) {
       		$name = $_POST['name'];
       	} else {
       		echo "
       			<form method='post' action='options.php'>
       			name : <input type='text' name='name'>
       			<input type='submit' value='submit'>
       			</form>
       		";
       	}
   
       	$text = str_replace('foo',$name,$text); //replace $name -> foo
       	return $text;
       }
   
       add_filter('the_content','my_function');
       ?>
       ```
   
 * ==========================================================
    path : /wp-content/
   plugins/myplugin/options.php
 * 1. <form method=’post’ action=’options.php’>
 * result = Object not found!
 * or
 * 2. <form method=’post’ action=’wp-content/plugins/myplugin/options.php’>
 * result = Fatal error: Call to undefined function add_filter() in D:\xampp\htdocs\
   thwordpress\wp-content\plugins\myplugin\options.php on line 23
    =============
   =========================================================
 *  Anonymous User
 * (@anonymized-3085)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/what-went-wrong-my-plugin/#post-1788772)
 * [Writing a Plugin](http://codex.wordpress.org/Writing_a_Plugin)

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

The topic ‘What went wrong? my plugin’ is closed to new replies.

 * 3 replies
 * 3 participants
 * Last reply from: Anonymous User
 * Last activity: [15 years, 5 months ago](https://wordpress.org/support/topic/what-went-wrong-my-plugin/#post-1788772)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
