Add suggestion for user to choose his username in php
<p>I'm beginner in php. I solve a problem. When user enter his username if the username is already exist in database. the program add 1,2,3,4.. and up to so on for uniqueness. I just want to show this username under the form field and user select this name and it is add in form.</p>

<pre><code>&lt;?php 
include('config.php');

    $username=$_POST['username'];
    $select="select * from username where username='$username'";
    $query=mysql_query($select,$con);
    $count=mysql_num_rows($query);
    if($count==1)
    {
        for ($j=1; $j &lt;=10 ; $j++)
        { 


            for ($i=1; $i &lt;=$j ; $i++) 
            { 
                $newusername=$username.$j;
                $select1="select * from username where username='$newusername'";
                $query1=mysql_query($select1,$con);
                $count1=mysql_num_rows($query1);
                if ($count1==1) 
                {

                }
                else
                 {

                    echo $newusername;
                    header('location:a.php');
                    exit();

                }

            }           
        }


    }
    else
    {
        echo $username;
    }


 ?&gt;
</code></pre>
