kevinp wrote:What a fantastic script. It seems the posibilities are endless.
I've added the file below to 'After Form Data Reception Include URL' on the includes section which adds a unique ID to each email. This works fine but the ID doesn't save to the csv file. Is there a way to make the script include $rnd_id when it creates the CSV.
Change the code to
Code: Select all
<?
//set the random id length
$random_id_length = 8;
//generates a random id encrypt it and store it in $rnd_id
$rnd_id = crypt(uniqid(rand(),1));
//removes any slashes that might have been generated
$rnd_id = strip_tags(stripslashes($rnd_id));
//Removing any . or / and reversing the string
$rnd_id = str_replace(".","",$rnd_id);
$rnd_id = strrev(str_replace("/","",$rnd_id));
//finally take the first 8 characters from the $rnd_id
$rnd_id = substr($rnd_id,0,$random_id_length);
// I've added this later in the echo and e-mail
//echo "When contacting us please quote: $rnd_id";
//Converts the reference to uppercase
$rnd_id = strtoupper($rnd_id);
$POST['Submission ID'] = $rnd_id; // This line adds in the POST array the unique ID you created
$autoresponderend .= "\nWhen contacting us please quote: $rnd_id"; // This line adds to the autoresponder footer the message with the quote ID
?>
Note the changed $POST instead of $_POST
Also, If I wanted to echo some of the form fields to the success page as a confirmation of the submission is this possible using the Copy in or Copy from session options. I can't seem to identify the correct $names to show the fields.
The easiest way is to add another include.
Lets suppose that you have created a success page, named "success.php". Write the text that you want to have in the page, and in the place of the variables that need to be merged, place this text (as an example):
'.$Name.'
This can be in the middle of a sentence, in which case it will be something like:
Hello '.$Name.' Thank you for your Submission! '
Obviously, $Name is the variable, EXACTLY as your form field (Name)
AVOID form field names with white spaces, in example "How did you find us", use underscores "How_did_you_find_us". The script will strip the underscores off when mailing you.
Right click the text and add the following in the Before tag of the text html:
<?
echo '
and in the After tag,
';
?>
Now, in Start of page add:
<?
extract($POST, EXTR_OVERWRITE);
?>
Set the form processor as follows:
After Processing Befavior : Include
Immediately the next field:
Page or script to include before script ends: success.php
Published the changed form page and the success page and test.