Title: PHP Form submit problems
Last modified: August 19, 2016

---

# PHP Form submit problems

 *  [hubs](https://wordpress.org/support/users/hubs/)
 * (@hubs)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-form-submit-problems-1/)
 * I tried making a new page from the pages-default.php. I’m using the carrington
   theme. The code looks like this:
 *     ```
       <?php
   
       /*
       Template Name: Boyfriendnicknames
       */
   
       // This file is part of the Carrington Blog Theme for WordPress
       // http://carringtontheme.com
       //
       // Copyright (c) 2008-2009 Crowd Favorite, Ltd. All rights reserved.
       // http://crowdfavorite.com
       //
       // Released under the GPL license
       // http://www.opensource.org/licenses/gpl-license.php
       //
       // **********************************************************************
       // This program is distributed in the hope that it will be useful, but
       // WITHOUT ANY WARRANTY; without even the implied warranty of
       // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
       // **********************************************************************
   
       if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { die(); }
       if (CFCT_DEBUG) { cfct_banner(__FILE__); }
   
       get_header();
   
       ?>
   
       <div id="content">
       <h2>Generate Your Wu-Name</h2>
       <p><hr size=1 noshade></p>
   
         <form action="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD="POST">
           <p><b>Enter your Name: </b><br />
           <input type="text" name="realname" size=25> &nbsp; &nbsp;
           <input type="submit" value="Submit">
           </p>
         </form>
   
       <p><hr size=1 noshade></p>
   
       <?
       if ($_SERVER['REQUEST_METHOD'] == "POST") {
           $realname = $_POST['realname'];
           $displayname = $realname;
           $realname = strtolower($realname);
   
           /*== generate seed number from name submitted ==*/
           $len = strlen($realname);
           $seed = 0; $s = 0;
   
           for ($e=1; $e<=$len; $e++)
           {
             $chr = substr($realname,$s,$e);
             $seed = $seed + ord($chr)*$e;
   
             $s=$e;
           }
   
           /*== read in the two files into the arrays ==*/
           $adj_array = file("wu_adjs.txt");
           $noun_array = file("wu_nouns.txt");
   
           /*== set random seed ==*/
           srand($seed);
   
           /*== get the random numbers for each name first/last or adj/noun ==*/
           $arnd = rand(0,sizeof($adj_array)-1);
           $nrnd = rand(0,sizeof($noun_array)-1);
   
           /*== create name from random numbers ==*/
           $wuname = "$adj_array[$arnd] $noun_array[$nrnd]";
   
           print "<p><font size=4><b>$displayname</b> from this day forward you <br />you will also be known as ";
           print "<font size='+1'><b> $wuname </b></font></font></p>";
   
         }
   
       ?>
           <div id="comments">
       <?php
           comments_template();
       ?>
           </div><!--#comments-->
       </div><!--#content-->
   
       <?php
   
       get_sidebar();
       get_footer();
   
       ?>
       ```
   
 * But I am having the same problem. When I click submit, it returns me to the front
   page of my blog. I suspect that it has something to do with this line:
 * `<form action="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD="POST">`
 * But I’m unsure how to fix it. Any help would be grateful.
 * You can test it here:
    [http://www.artifacting.com/blog/get-cute-nicknames-for-your-boyfriend-or-girlfriend/](http://www.artifacting.com/blog/get-cute-nicknames-for-your-boyfriend-or-girlfriend/)

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

 *  Thread Starter [hubs](https://wordpress.org/support/users/hubs/)
 * (@hubs)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/php-form-submit-problems-1/#post-1042587)
 * bump.
 *  [dan_m2k](https://wordpress.org/support/users/dan_m2k/)
 * (@dan_m2k)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/php-form-submit-problems-1/#post-1042674)
 * I’d suggest adding action=”” to submit to itself and see if that works submitting
   to itself.

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

The topic ‘PHP Form submit problems’ is closed to new replies.

## Tags

 * [form](https://wordpress.org/support/topic-tag/form/)
 * [pages](https://wordpress.org/support/topic-tag/pages/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [submit](https://wordpress.org/support/topic-tag/submit/)

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 2 replies
 * 2 participants
 * Last reply from: [dan_m2k](https://wordpress.org/support/users/dan_m2k/)
 * Last activity: [17 years, 1 month ago](https://wordpress.org/support/topic/php-form-submit-problems-1/#post-1042674)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
