danibee2k Posted April 29, 2009 Share Posted April 29, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/156085-random-number-generator-on-click-which-then-emails-number/ Share on other sites More sharing options...
ignace Posted April 29, 2009 Share Posted April 29, 2009 how long must that unique number be? <?php $rand = sha1(time()); // 40-chars ?> Quote Link to comment https://forums.phpfreaks.com/topic/156085-random-number-generator-on-click-which-then-emails-number/#findComment-821688 Share on other sites More sharing options...
ignace Posted April 29, 2009 Share Posted April 29, 2009 More resources: http://be.php.net/manual/en/function.uniqid.php http://be.php.net/manual/en/function.mt-rand.php Quote Link to comment https://forums.phpfreaks.com/topic/156085-random-number-generator-on-click-which-then-emails-number/#findComment-821689 Share on other sites More sharing options...
danibee2k Posted April 29, 2009 Author Share Posted April 29, 2009 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 ?> Quote Link to comment https://forums.phpfreaks.com/topic/156085-random-number-generator-on-click-which-then-emails-number/#findComment-821694 Share on other sites More sharing options...
danibee2k Posted April 29, 2009 Author Share Posted April 29, 2009 More resources: http://be.php.net/manual/en/function.uniqid.php http://be.php.net/manual/en/function.mt-rand.php Thanks :-) Quote Link to comment https://forums.phpfreaks.com/topic/156085-random-number-generator-on-click-which-then-emails-number/#findComment-821697 Share on other sites More sharing options...
ignace Posted April 29, 2009 Share Posted April 29, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/156085-random-number-generator-on-click-which-then-emails-number/#findComment-821698 Share on other sites More sharing options...
danibee2k Posted April 29, 2009 Author Share Posted April 29, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/156085-random-number-generator-on-click-which-then-emails-number/#findComment-821704 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.