0
Today in my form, I have the mail.php file where to read the form data and send by email. This form is an online order form, where users already registered Ogan and place orders. Well, I’ve assembled everything based on research and studies on the web, I’m not a connoisseur of the language in php, but I understand very little. Today I came to put the code (below), to generate the random numbers with the function Rand(), not to run the risk of repeating numbers I found this formula:
<?
$numeros = array(0,1,2,3,4,5,6,7,8,9);
$total_num = count($numeros)-1;
$numPedido = $id . $numeros[rand(0,$total_num)] . $numeros[rand(0,$total_num)] . $numeros[rand(0,$total_num)] ;
$gerador = $numPedido;
?>
Well, you did, generating numbers without the need for a database, but you’d like to use them sequentially, is there a way? It has as some function, in javascript, I don’t know, that can save the number information in TXT file and then consult the file not to repeat the number?
I’ve found several tutorials on the use of comics, but I found it complicated. Since the order form is not saved anywhere, it is only sent by email, we only use the BD to upload the user’s data and of course, to have access to the online order.
This code I used put in the file mail.php. So the number appears in the body of the email and put to appear also in the subject.
Thank you for your attention!!
Where this number will be used?
– Papa Charlie