Hello. I am setting up a webpage form and use the below php as the form handler.
I’d like the PHP to generate a random “confirmation number”.
I also want the “confirmation number” to be included in the form that I receive via email as well as the confirmation email that is auto-generated and sent to the user. Any help?
[php]
<?php $subject = 'Register Me Today!'; $emailadd = '[email protected]'; $url = 'confirmation.html'; $req = '0'; $text = "Results from webpage:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 20) {echo "Name of form element $key cannot be longer than 20 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } $headers = 'Cc: [email protected]' . "\r\n"; mail($emailadd, $subject, $text, 'From: '.$emailadd.'', $headers); $email = $_POST['Email']; $subject = 'We will be in contact with you shortly'; $text = 'Dear Business Owner, Your request for more information has been received. One of our representatives will be in contact with you shortly! For Your Records, your registration number is _________. .....blah blah blah '; // change text mail($email, $subject, $text, 'From: '.$emailadd.''); echo ''; ?>[/php]