I have a client that wants the output of a form to look exactly like the form that the information was entered into. They have a form that is sent to an e-mail and a fax machine...we helped them set that up but now they want the output to look like the form that they used to gather input. So...how do we control what the output of a form looks like?
bombino
07-29-2001, 11:40 AM
If it was me, I'd write a custom FormMailer script in PHP.
Here's a quick and dirty example:
<?
$body_of_mail = "Name: $name\nAddress: $address\n";
mail("email@domain.com","Subject here",$body_of_mail,"From: replyto@domain.com");
?>
E-Mail me, and I'd be more than happy to help ya.
slade
07-29-2001, 01:32 PM
That's probably your best choice.
You could also have this script output a html page that looks like the form it was entered into. Most gui email programs can parse that.
As for the fax, I'm curious about how you're doing that. Depending on what you're using, you could also possibly use the same concept to get a decent looking fax form.
eclipsewebs
07-30-2001, 11:35 AM
I am not sure if this would work or not, but you might be able to show them an adobe acrobat (.pdf) file that they can enter text into, and then somehow send it. Just a thought.
We have looked at PDf and the problem is the same it seems. When the mail handler converts the form it ends up in a linear text. We need the data fields to be maintained in the arrangement as they were entered.
Thank you for the suggestion though.
kunal
07-30-2001, 12:04 PM
I dunt understand the problem. It should be easy .. just send HTML emails.. format your html like the form... and replace the form fields with the actual data.. ?
I want to make sure I am understanding your suggestion.
What we have is a web page form that the customers of this client fill out. When they click submit it sends the contents of the form to an e-mail address and to a fax machine at our clients business. The form is formatted in a specific way, a table with 4 columns and 30 rows. They need this format carried through to the fax machine. How do we do this with an html e-mail?
slade
07-30-2001, 07:34 PM
Somewhere near the end of your script is a post to a cgi that sends the email.
Replace this with the mailto function that is native to the language you are using. (Something that calls sendmail)
You'll want to add a module that takes in all the form data as arguments(an array maybe?), and outputs one long properly formatted html string.
$mailmessage = "<html><body><pre>\r\n";
$mailmessage .= line by line adding your data just the way you want it
$mailmessage .= "\r\n</pre></body></html>\r\n";
This is what you'll give to your sendmail function.
I used php for a form script, and this is what i send if there is an error:
mail("quicksignup@my-hosting-site", "Signup FAILED: $cust[n_first] $cust[n_last]", $mailmessage);
kunal
07-31-2001, 01:53 AM
slade is on the right track...
but his suggestion is now what i had i mind..
you can construct another string $main, and then assign the form variables to it. Something like this can be used.
[php]
$f1 = "Name";
$f2 = "Address";
$f3 = "Phone";
and so on..
now..
you need to create your email body
$body = "
<html><head></head><body><table><tr>
<td>$f1</td><td>$f2</td><td>$f3</td><td>$f4</td></tr>
</table></body></html>";
and so on and so forth.. this is just a quick lil hack.. not the most efficient.. but its an idea..