chrisboots Posted April 19, 2010 Posted April 19, 2010 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 chrisBOOKING FORM.pdf
localzuk Posted April 19, 2010 Posted April 19, 2010 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?
chrisboots Posted April 19, 2010 Author Posted April 19, 2010 website is curently in html, can do javascript as well as php. not sure about any others
LosOjos Posted April 19, 2010 Posted April 19, 2010 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....
chrisboots Posted April 19, 2010 Author Posted April 19, 2010 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.
LosOjos Posted April 19, 2010 Posted April 19, 2010 HTML email is definitely the way to go I think, take a look at these pages to get you on the right track PHP: A simple tutorial - Manual PHP Passing Variables Across Pages Sending Nice HTML Email with PHP | CSS-Tricks
localzuk Posted April 19, 2010 Posted April 19, 2010 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
chrisboots Posted April 19, 2010 Author Posted April 19, 2010 have had a quick look at the link, this may take some time!!!. why isint it easy
localzuk Posted April 19, 2010 Posted April 19, 2010 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.
LosOjos Posted April 19, 2010 Posted April 19, 2010 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
chrisboots Posted April 19, 2010 Author Posted April 19, 2010 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.
localzuk Posted April 19, 2010 Posted April 19, 2010 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.
chrisboots Posted April 19, 2010 Author Posted April 19, 2010 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 ?
SteveBentley Posted April 19, 2010 Posted April 19, 2010 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!
localzuk Posted April 19, 2010 Posted April 19, 2010 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).
chrisboots Posted April 19, 2010 Author Posted April 19, 2010 what do you mean by sent in a html format>??
LosOjos Posted April 19, 2010 Posted April 19, 2010 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
localzuk Posted April 19, 2010 Posted April 19, 2010 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).
LosOjos Posted April 19, 2010 Posted April 19, 2010 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
SteveBentley Posted April 19, 2010 Posted April 19, 2010 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.
CESIL Posted April 19, 2010 Posted April 19, 2010 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.
rlweb Posted April 22, 2010 Posted April 22, 2010 (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 April 22, 2010 by rlweb noticed a mistake with code
SteveBentley Posted April 23, 2010 Posted April 23, 2010 That looks interesting - have you got a link for the library you're including?
rlweb Posted April 23, 2010 Posted April 23, 2010 Powerful component based mailing library for PHP – Swift Mailer Its a very easy to use class but I've found problems with smtp but that could my host.
powdarrmonkey Posted April 23, 2010 Posted April 23, 2010 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now