hi
i need help here
i have a form which will be filled by user his name email phone number etc...and then that information will be submitted into my ZOHO CRM account and using that information i like to fill a Proposal and Generate a PDF of that Proposal and send to user email as well..
so far i have created a PDF send to my email using FPDF and HTMLTOPDF libs ...
but cant fig out how i can get data from user and send it to ZOHO CRM and Generate PDF and send user email ...

i just need small example to get data fill the blanks in my Proposal document and generate pdf and send to that users email and add his given info into my account at same time....

sample.html file which will be converted to pdf and email to the given address...

<?php
require('html2fpdf.php');
$pdf=new HTML2FPDF();
$pdf->AddPage();
$fp = fopen("sample.html","r");
$strContent = fread($fp, filesize("sample.html"));
fclose($fp);
$pdf->WriteHTML($strContent);
//$pdf->Output("sample.pdf");
$to = "something@gmail.com"; 
$from = "something@gmail.com"; 
$subject = "send email with pdf attachment"; 
$message = "<p>Please see the attachment.</p>";

// a random hash will be necessary to send mixed content
$separator = md5(time());

// carriage return type (we use a PHP end of line constant)
$eol = PHP_EOL;

// attachment name
$filename = "example.pdf";

// encode data (puts attachment in proper format)
$pdfdoc = $pdf->Output("", "S");
$attachment = chunk_split(base64_encode($pdfdoc));


// main header (multipart mandatory)
$headers  = "From: ".$from.$eol;
$headers .= "MIME-Version: 1.0".$eol; 
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\"".$eol.$eol; 
$headers .= "Content-Transfer-Encoding: 7bit".$eol;
$headers .= "This is a MIME encoded message.".$eol.$eol;

// message
$headers .= "--".$separator.$eol;
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol;
$headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
$headers .= $message.$eol.$eol;

// attachment
$headers .= "--".$separator.$eol;
$headers .= "Content-Type: application/octet-stream; name=\"".$filename."\"".$eol; 
$headers .= "Content-Transfer-Encoding: base64".$eol;
$headers .= "Content-Disposition: attachment".$eol.$eol;
$headers .= $attachment.$eol.$eol;
$headers .= "--".$separator."--";

// send message
mail($to, $subject, "", $headers);
echo "PDF file is generated successfully!";
?>

bump anyone ...

This isn't totally clear so let me recap my understanding and add some questions:

1. You have a form that is presumably a request for a proposal that the user fills. I assume that is a html / php script that you have written.

2. The action on the form is presumably a PHP program that you wrote. If I interpret what you are saying, you would like to get that info into Zoho CRM (from that program). If you want to do this sort of integration with Zoho, it seems that you need to become quite expert in the use of their API. I'm not sure why you are coming to this forum without having already read the API documentation, figured out the steps for the integration and tried it. If you have questions about Zoho integration and use of the API, I think it would make sense to use the Zoho Forums for such questions since they would be most likely to have the appropriate experience and knowledge.

3. From a quick look at Zoho, they don't seem to have a specific module to support proposal writing. They do presumably have the ability to record Sales Leads / customers and that is probably where the info from your customer form needs to go.

4. You have a proposal document and that is presumably your sample.html file. Are you trying to do something with Zoho for this document or is it merely a matter of creating it and storing it somewhere?

5. From a reasonability point of view, how many of these requests are you going to get and is that worth a lot of effort to do some fancy automation? It seems that you could do this relatively easily outside of Zoho and then take the resulting information and add it to Zoho after the fact. If it was up to me, I would probably do all of this outside of Zoho, except maybe recording the Sales Lead info into Zoho in the easiest way possible. It isn't that difficult for the program receiving the customer info to read in a template, add the info from the customer, produce the PDF and email it to the Customer. I use HTML2PDF to create PDFs and LibMail to send emails (especially with an attachment) because they are a bit simpler than what you have done but it can work either way. If you end up with a folder of pdf documents identified by customer name and the date generated, that would probably serve your needs quite well.

6. If your code above is successfully sending a PDF of your template to you, then it should be pretty easy to add the customer info and save the PDF file somewhere. This program needs to be the "action" on the form that the customer is using. If your sample.html is your template then I suggest that you need to insert some special strings into that file that you can replace with the actual customer data (e.g. ^^first_name^^) by doing a a str_replace. This is a good application for a template engine and RainTPL is one that is very simple to use. You could do that instead of creating your own.

ok
-> i have have created a form using ZOHO leads form Generate i just check few field and it created a form for me ....fields like user email,no of employees, company name , type ects..
-> i have a proposal file which is going to be send to that user who fills the form ....now using that user info i am going to fill some fields like his company name , his name ,etc ..and send him as PDF file.
-> and i also like to add that user info in to my ZOHO CRM account ....

my point is that i need a example that how i can fill fields in proposal document and also send data to ZOHO account ..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.