title: Sending random number to email PHP
body: <p>i am trying to send a random number to an email but unable to this is the code that i have been able to come up with so far 
  please help if possible  </p>
  
  <p><strong>sendmail.php</strong></p>
  
  <pre><code>$to = $_POST['email'];
  $header ='From:admin@domain.com';
  $subject ='Verification Code';  
  
      if(empty($to))
          {
              echo "Email is Empty";
          }
          else
          {
              if (mail($to,$subject,$message,$header)){
  
               echo 'Check Your Email FOr verfication code';
              }
              else{
                  echo 'Failed';
              } 
          }
  </code></pre>
  
  <p>index.php </p>
  
  <pre><code>&lt;form action = "register.php" method="POST"&gt;
  
  &lt;p&gt;Username&lt;/p&gt;
  &lt;input type="text" name="username" maxlength="40" value='&lt;?php if(isset($username)) echo $username ?&gt;'"&gt;&lt;br&gt;
  
  &lt;p&gt;New Password&lt;/p&gt;
  &lt;input type="password" name="password"&gt; 
  
   &lt;p&gt;email&lt;/p&gt;
  &lt;input type="text" name="email" maxlength="40" value='&lt;?php if(isset($email)) echo $email ?&gt;'"&gt; &lt;br&gt;&lt;br&gt;
  &lt;input type="submit" value="Register"&gt; &lt;br&gt;&lt;br&gt;
  &lt;/form&gt;
  </code></pre>