Jump to content

Random number generator on click which then emails number


danibee2k

Recommended Posts

Hi,

 

I hope I've posted this in the right place as this is my first time here, if not please let me know and I will move it! lol!

 

Ok, I need to create a form whereby on entering a Forename and an Email address, the user clicks submit and a random unique number is generated which is then emailed to the email address entered and to myself.  Does anyone have any suggestions of how I can do this.  I have no problems with creating forms it is more the random number generator and then emailing that to the entered email address that is causing me problems!  Worse comes the worse the number generated can become visible on click and simply email to myself if it is not possible to email it to the address just entered.

 

Don't know if that made any sense or not, please ask me if you need me to clarify!  Hopefully someone can help, it is urgent as I'm working to a deadline.

 

Thanks so much

 

Dani

Link to comment
Share on other sites

It doesn't have to be particularly long, 5 or 6 numbers would be sufficient.  Sorry to sound ignorant (however I am!) but could I use this code to generate a unique number in a form field so that on submitting the form it could be emailed to myself and the email address the user entered?  As a bit more background, there is no need for any database linkage, the number is not going to be stored, simply emailed.

 

how long must that unique number be?

 

<?php
$rand = sha1(time()); // 40-chars
?>

Link to comment
Share on other sites

It doesn't have to be particularly long, 5 or 6 numbers would be sufficient.  Sorry to sound ignorant (however I am!) but could I use this code to generate a unique number in a form field so that on submitting the form it could be emailed to myself and the email address the user entered?  As a bit more background, there is no need for any database linkage, the number is not going to be stored, simply emailed.

 

how long must that unique number be?

 

<?php
$rand = sha1(time()); // 40-chars
?>

 

yep that is no problem, not even in a database context

Link to comment
Share on other sites

Brilliant!! You are an absolute star! Will have a go and see how I get on.

 

It doesn't have to be particularly long, 5 or 6 numbers would be sufficient.  Sorry to sound ignorant (however I am!) but could I use this code to generate a unique number in a form field so that on submitting the form it could be emailed to myself and the email address the user entered?  As a bit more background, there is no need for any database linkage, the number is not going to be stored, simply emailed.

 

how long must that unique number be?

 

<?php
$rand = sha1(time()); // 40-chars
?>

 

yep that is no problem, not even in a database context

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.