Hi guys,
I need to upload a file in html format to a database, shouldn't be a problem using text or blobs.
I then need to edit this html file, changing name feilds in it to names in my database for several people.
Then email them.
The uploading and emailing isn't a problem but I am having trouble finding resources to help me change the feilds in the html file.
Any help anyone could provide would be greatly appreciated.
Thanks
Edit html file fields
Moderator: General Moderators
Re: Edit html file fields
So basically you want a mail merge.
Loop over the email send, changing the html each time based on the name in the database.
I've used generic variables for the FOR loop, but they are meant to represent the record set extracted from the database table
This is the rough idea anyway. Hope it helps
Loop over the email send, changing the html each time based on the name in the database.
I've used generic variables for the FOR loop, but they are meant to represent the record set extracted from the database table
Code: Select all
for ($start_of_resultset; !$end_of_resultset; $next_row_in_set) {
#get name from active row in recordset
$name = $resultset['name'];
#string replace the fieldname in the html with the name from the db
$new_html = str_replace($field_in_html, $name, $default_html);
#send the email using the html as the body content
mail($to, $subject, $new_html);
}