Jump to content

Recommended Posts

Posted

i have made a email form for my works website, booking form- Penny Car Hire) and have just been told that now they want the infomation gathered on the from to automaticly go into a file they have made so it can be printed easily will all boxes filled out. Is it possible. the titel says pdf but it dosent have to be I only put it as that as that is the file type of the sheet they have given me.

attached is the form. can the infomaton be take off the email form and but streight into the document.

 

 

thanks

 

chris

BOOKING FORM.pdf

Posted
I'd be thinking 'HTML email' myself, and get the server to generate the form in HTML format, with the data in it. What server side languages are available to you?
Posted
How are you at using PHP? It should be pretty simple to write up a PHP script to write the info in to either an HTML email (as suggested by localzuk) or a new page ready to be printed. Alternatively, layout the initial page how you want it and just add a 'Print' button to the bottom of the page....
Posted
have not used php yet, but can lern. have set up an html email form it all works fine, but now my boos has decided he want it to go onto something like the file attached onto the first post.
Posted
have not used php yet, but can lern. have set up an html email form it all works fine, but now my boos has decided he want it to go onto something like the file attached onto the first post.

 

You need to create a php script which generates an email, with the contents being the file layout you wanted. This site gives some insight into using PHP to send email in HTML format: Advanced email in PHP as does this thread php: simple code to send HTML email - Web Hosting Talk

Posted
have had a quick look at the link, this may take some time!!!. why isint it easy

 

Because creating advanced functionality in a site is a complex process usually undertaken by programmers, rather than web designers. :)

Posted
have had a quick look at the link, this may take some time!!!. why isint it easy

 

PHP is pretty easy once you get to grips with it, and if you put the time in to learn to use it (I'd also look at SQL if you have time) your future websites will be infinitely more efficient, effective and easy to maintain than before

Posted

just spoke to my boss and he has said, is it possible for it to come to use like it is on the website. All the stuff in boxes ect ect. is that posiible, rather than coming in a email like:

firstname:chris

surname:boots

ect.ect.

Posted
just spoke to my boss and he has said, is it possible for it to come to use like it is on the website. All the stuff in boxes ect ect. is that posiible, rather than coming in a email like:

firstname:chris

surname:boots

ect.ect.

 

Only by creating a custom PHP script to do it for you - it is not a simple click job.

Posted
damn it!!. do you have any other suggestions on how to do it. it doestn have to be to a pdf. it could be anything that we can print that will look like the attached file ?
Posted

Might be possible if you put some HTML into the email to create tables.

 

Only other thing I can think of is have the form submit the user input into a database, and then use the Access to query the database (over ODBC) and put it into a nice looking form. Not a very elegant solution though!

Posted
damn it!!. do you have any other suggestions on how to do it. it doestn have to be to a pdf. it could be anything that we can print that will look like the attached file ?

 

Sorry but there is simply no quick and easy way of doing it. It is definitely a custom coding job. What we have been suggesting is the quickest way of doing it, ie. the email is sent in HTML format to the end user instead of in text format. (Not in PDF, that would make it even more complex).

Posted
Not being funny, but in the time spent dwelling on another way to do it (there's no simpler way to do it, not if you want it customised like you do) you could have had it up and running by now... take the plunge in to PHP, it's worth it (some might say essential) if you want a future creating websites
Posted
what do you mean by sent in a html format>??

 

Email is sent in 2 formats - plaintext and html. When you have a form with action 'mailto:' you are effectively getting the end user to use their own email client and email server to send a plaintext email. What is being proposed is that the server you run the site on sends the email instead. It formats this email as an html email, so when it appears in the inbox of the recipient it is displayed as a formatted email (ie. however you design the html code to look).

Posted
what do you mean by sent in a html format>??

 

This is what we've been saying all along, you need to create a PHP script to create an HTML email on the fly in the format you want. If you can't do this and are unwilling to learn some basic PHP, you're going to have to pay somebody to do it for you I'm afraid. But honestly, PHP isn't that difficult, not at this level, just invest a couple of hours in it and you should be able to do what you're trying to, although if you don't really understand HTML, paying a professional might be the only way forward

Posted

If you're doing action="mailto:[email protected]" then it's very likely to end in failure because it relies on the email client and web browser being properly set up. In these times when a lot of people don't actually have a proper mail client and just use webmail, it's no longer viable to use this method (if it ever was).

 

You can (although probably shouldn't) do this in a single line of PHP, it's more trivial than it looks.

Posted

I have built something like you need for a client.

 

I used a library called DOMPDF and this allows me to produce a PDF file from an HTML page.

 

In this case I am printing an order form which is built using PHP and CSS.

 

This is called by DOMPDF and a PDF is created scaled to fit an a4 page.

 

The hardest part is designing the page to get all the boxes etc where you want them.

Posted (edited)

I've recently done this for a client, was used to send invoices to clients.

 

I've simplified the code:

 

require_once '../_includes/swift/lib/swift_required.php';

//SMTP details I used gmail because I couldn't get the email to be not counted as spam
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')
 ->setUsername('[email protected]')
 ->setPassword('gmailpwhere')
 ;
//Loads an the controller
$mailer = Swift_Mailer::newInstance($transport);

//Create the message
$message = Swift_Message::newInstance();

//Gives the message a subject
$message->setSubject("Apperley Business Supplies Ltd -");

//Set the From address with an array
$message->setFrom(array('[email protected]' => 'Email from'));

//Set the To addresses with an associative array
$message->setTo(array('[email protected]' => 'Email to'));

//Give it a body
$body = "Hi,\n
\n
Website file Attached.\n
\n
Thanks,\n
Named\n";
$message->setBody($body);

$htmlbody = "





Hi,

Website file Attached.

Regards,

Name



";
 //And optionally an alternative body
$message->addPart($htmlbody, 'text/html');


//Creates a html file
ob_start();
?>




Untitled Document
<br />
body{<br />
	font-size:11px;<br />
	font-family:Verdana, Geneva, sans-serif;<br />
}<br />





echo $_GET['texbox']; ?>




$invoicehtml = ob_get_contents();
ob_end_clean();
//End html files put it into a variable

//Create the attachment with your data
$attachment = Swift_Attachment::newInstance($invoicehtml, "file.html", 'text/html');  

//Attach it to the message
$message->attach($attachment);

$result = $mailer->send($message);


Edited by rlweb
noticed a mistake with code
Posted
damn it!!. do you have any other suggestions on how to do it.

 

Hire a programmer? Seriously, if your form is accessible to the public, it will be attacked sooner or later, and you need it written in a way that can deflect malicious submissions.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • 11 When would you like EduGeek EDIT 2025 to be held?

    1. 1. Select a time period you can attend


      • I can make it in June\July
      • I can make it in August\Sept
      • Other time period. Please comment in the thread what works for you
      • Either time

×
×
  • Create New...