Random Code Generator PHP Scripta

Random Code Generator PHP Scripta

In this tutorial we are going to learn how to make a random code generator. You may download this file and use it to your projects or systems.

Creating Our Form
1. We need to create our form tag and the method is post..
2. Create our button, name it generate and the type is submit


 <form method="POST">
<button name="generate" type="submit">Generate Code</button>


Creating Our PHP Script
1. create a variable named today, it is the date today. We should include this to our script so that we can ensure that we are generating a unique random code.
2. create a variable name rand.
3. the name of the button should be the same in isset function.
4. Display the random code using the variable unique with the value of today and rand.


    $today = date("Ymd");
    $rand = strtoupper(substr(uniqid(sha1(time())),0,6));
          if (isset($_POST['generate']))
                echo $unique = $today . $rand;            


That’s it, you have successfully created a random code generator. Feel free to comment your suggestions below or email me at [email protected]



Learn How to install Random Code Generator PHP Scripta?

Find More Random Code Generator PHP Scripta

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *