dimanche 1 novembre 2015

Sending random number to email PHP

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

$rand= mt_rand(100000, 999999)// random number generator
$email = $_POST['email'];
$to=$email;
$header ='From:admin@domain.com';
$subject ='Verification Code';
$body = $rand;


  if (mail($to,$subject,$body,$header))
    {
     echo 'Check Your Email FOr verfication code';
    }
         else{
          echo 'Failed';
          } 

<p>email</p>
<input type="text" name="email" maxlength="40" 
value='<?php if(isset($email)) echo $email ?>'"> <br>

<input type="submit" value="Register"> <br><br>

i dont know what i am doing wrong




Aucun commentaire:

Enregistrer un commentaire