Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Possible to insert form data into a document?
Old 09-29-2010, 10:34 AM Possible to insert form data into a document?
Junior Talker

Posts: 3
Trades: 0
Here's what I'm looking to do...

We need to create a contract (legal document) in PDF format that is based on info a customer fills out in a web form. Currently we just manually copy & paste each field into a Word document, then convert that doc to a PDF file, then email it to the customer.

Is there any way to have the customer fill out a form on the website, then somehow dynamically insert that data into a pre-written template type of document or PDF file?

By the way, this is for a Wordpress site and I'm using the GravityForms plugin for the web form. I'd prefer to continue using GravityForms if possible, but I'm open to other suggestions.

Any thoughts or ideas would be appreciated.

Thanks!
SoundsGood is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-29-2010, 11:43 AM Re: Possible to insert form data into a document?
Justinwiz's Avatar
Skilled Talker

Posts: 58
Name: Justin
Location: /etc/httpd/logs/error_log
Trades: 0
I have no experience with those systems/plugins, but here's a simple data insertion script:

PHP Code:
<?php
if($_POST['next'] == "true") {

$name $_POST['name'];
$email "---YOUR EMAIL HERE---"//Enter your email here

//Use <br /> in the document text after every line if it's going to be added to a web page directly

$document = <<<EOF

This is the document....
Your name is 
$name and your custom info is $_POST[custom]
More text.....

EOF;


// Uncomment below to email the document
/*
if(mail($email, $name, $document) == true) {
echo "Success!";
} else {
echo "Failed!";
}
*/
echo $document;


} else {

//Just add more inputs with different names and use the $_POST[NAME HERE] method to call them.
//A new input would look like this: '<input type="text" name="moreinfo" id="moreinfo">' you can call it's data with $_POST[moreinfo] within the document.
?>
<form action="" method="POST">
Name: <input type="text" id="name" name="name"><br>
Custom: <input type="text" id="custom" name="custom">
<input type="hidden" name="next" id="next" value="true">
<input type="submit">
</form>
<?php
}
?>
This will insert the data from the form into a text block, you can then send it to yourself by uncommenting the email code.

Made this quickly and tested it on my server, I hope it helped you!

Justinwiz is offline
Reply With Quote
View Public Profile
 
Old 09-30-2010, 08:24 AM Re: Possible to insert form data into a document?
Junior Talker

Posts: 3
Trades: 0
Quote:
Originally Posted by Justinwiz View Post
I have no experience with those systems/plugins, but here's a simple data insertion script:
Wow, Justin, thanks so much! I'd still like to try to use the GravityForms plugin (if possible), plus this stuff is a bit over my head... so any idea where I might find someone to hire to help with this?

Thanks again...
SoundsGood is offline
Reply With Quote
View Public Profile
 
Old 09-30-2010, 11:33 AM Re: Possible to insert form data into a document?
Justinwiz's Avatar
Skilled Talker

Posts: 58
Name: Justin
Location: /etc/httpd/logs/error_log
Trades: 0
I looked at the demo of Gravity Form on the official website, though I can't seem to find a place to add custom code to the forms...
You can probably post here: http://www.webmaster-talk.com/blogging-forum/
Users in the Blogging Forum will know more about Gravity Form than me.

Good Luck!
Justinwiz is offline
Reply With Quote
View Public Profile
 
Old 10-07-2010, 10:46 AM Re: Possible to insert form data into a document?
Junior Talker

Posts: 3
Trades: 0
Quote:
Originally Posted by Justinwiz View Post
I looked at the demo of Gravity Form on the official website, though I can't seem to find a place to add custom code to the forms...
You can probably post here: http://www.webmaster-talk.com/blogging-forum/
Users in the Blogging Forum will know more about Gravity Form than me.

Good Luck!
Thanks, Justin! Sorry for the delayed reply, I had to go out of town.
SoundsGood is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Possible to insert form data into a document?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15074 seconds with 12 queries