Google Ads

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

 

Code:
 
  1. <form method="POST">
  2. <button name="generate" type="submit">Generate Code</button>
  3. </form>

 

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.

 

Code:
 
  1. <?php
  2. $today = date("Ymd");
  3. $rand = strtoupper(substr(uniqid(sha1(time())),0,6));
  4. if (isset($_POST['generate']))
  5. {
  6. echo $unique = $today . $rand;
  7. }
  8. ?>

 

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

 

 


Related Post

Laravel Contact – Online Contact Management ... Laravel Contact - Online Contact Management App PHP Script Laravel contact is an absolute multi user’s online contact management application built ...
Panda Resort 4 – CMS for Single Hotel –... Panda Resort 4 - CMS for Single Hotel - Booking SystemPanda Resort 4 - CMS for Single Hotel - Booking SystemPanda Resort a web software to create and ...
MailWizz v1.4.3 – Email Marketing Applicatio... MailWizz v1.4.3 - Email Marketing ApplicationMailWizz v1.4.3 - Email Marketing ApplicationMailWizz EMA is a simple to use, efficient and full-featured...
Zlogin – Simple Login System with Bootstrap ... Zlogin - Simple Login System with BootstrapZlogin - Simple Login System with BootstrapZlogin is simple, secured and easy to customize Login & users ma...
ERP – Business Resource Planning Management ... ERP is a Modern and Responsive Business management system. It is developed by PHP and Laravel framework. It is designed and develops for small & B...

Have any Question or Comment?

Leave a Reply

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

"