Generate regular expression based on inputted number This is my first PHP script (although I like to think I'm a good general coder).  

The script accepts a number from the user, uses it to generate a regular expression, and then returns all dictionary words that match that expression. 

It's currently live here, and I'd appreciate any comments on style, security, best practices, and even efficiency. Please ignore the Html for now - it's got a WordPress template to be inserted into later on. 

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Major Analysis Number Encoder&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;H1&gt;Tool for finding keywords for major analysis&lt;/h1&gt;
    This tool uses the numbering system shown by Derren Brown in the
    excellent book
    &lt;a
        href="http://www.amazon.co.uk/Tricks-Mind-Derren-Brown/dp/1905026269"&gt;Trick
        of the mind&lt;/a&gt;. For a (much better) tool that uses the older
    numbering system see
    &lt;a href="http://www.rememberg.com/"&gt;http://www.rememberg.com/&lt;/a&gt;&lt;br&gt;
    &lt;form action="majorEncoder.php" method="post"&gt;
        &lt;label for="firstname"&gt;Number to encode (at least three digits
            please):&lt;/label&gt; &lt;input type="text" id="targetNumber"
            name="targetNumber" /&gt;&lt;br /&gt; &lt;input type="submit"
            value="Generate results" name="submit" /&gt;
    &lt;/form&gt;
&lt;?php
if ($_POST != null) {

    $target = $_POST ['targetNumber'];
    if (strlen ( $target ) &gt;= 3) {
        $f = '[waeiouyc]?';
        $regex = '/^' . $f . $target;
        echo 'You entered the target' . $target . '&lt;br&gt;&lt;br&gt;';
        $regex = str_replace ( '1', 'l' . $f, $regex );
        $regex = str_replace ( '2', 'n' . $f, $regex );
        $regex = str_replace ( '3', 'm' . $f, $regex );
        $regex = str_replace ( '4', 'r' . $f, $regex );
        $regex = str_replace ( '5', '[fv]' . $f, $regex );
        $regex = str_replace ( '6', '[bp]' . $f, $regex );
        $regex = str_replace ( '7', 't' . $f, $regex );
        $regex = str_replace ( '8', '[sc]h' . $f, $regex );
        $regex = str_replace ( '9', '[gd]' . $f, $regex );
        $regex = str_replace ( '0', '[sz]' . $f, $regex );
        $lines = file ( 'words.txt' );

        $fl_array = preg_grep ( $regex . '$/', $lines );
        if (sizeof ( $fl_array ) &gt; 0) {
            echo 'Exact matches: &lt;br&gt;';
            foreach ( $fl_array as $element ) {
                echo $element . '&lt;br&gt;';
            }
            echo '&lt;br&gt;';
        }
        $fl_array = preg_grep ( $regex . '/', $lines );
        if (sizeof ( $fl_array ) &gt; 0) {
            echo 'Matches that allow trailing characters: &lt;br&gt;';
            foreach ( $fl_array as $element ) {
                echo $element . '&lt;br&gt;';
            }
        } else {
            echo "No matches found for the input $target";
        }
    } else {
        echo 'Please enter at least three digits&lt;br&gt;';
    }
}
?&gt;
&lt;/body&gt;
&lt;/html&gt;
One thing I would do is that str_replace can receive an array of items to look for and an array of its replacement:

PHP str_replace

// Provides: You should eat pizza, beer, and ice cream every day
$phrase  = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy   = array("pizza", "beer", "ice cream");

$newphrase = str_replace($healthy, $yummy, $phrase);


instead of going line by line to do it.

Just nit-picking but 

sizeof() is an alias of count() and count() is more widely used, so use something that is more general in the PHP community

Also $_POST != null would typically be !isset($_POST) rather as explained in this post