Jump to content

Using a Preexisting Word document with a Form


danhere

Recommended Posts

Hey Everybody,

I guess I'll start with a basic rundown of what I'm trying to do. I made a form that posts to another PHP page and then lets the user recheck the information they entered and then from there it emails both me and the user a preexisting word document filled out with the variables already in there(in theory). However, I'm running into trouble on the last part. What would be the best way to go about this? I tried an include() of the HTML code of the Word document but the variables only show up not actually write in ( $_POST[product]; ) instead of "Product". I'm kinda stumped because the HTML of the Word document has lots of double quotes and won't turn into a variable to use to echo into an actual Word document. And it has to be Word. I'm newer to PHP too so any help would be greatly appreciated.

Thanks,

-Dan

Unfortunately,

The document I'm working with is a legal document and I don't know the issues and stuff regarding it. But basically I'm trying to


//Create file "(Name) (Reference) (Secret Key)//
$filename = ($_POST[cosign]." ".$short." ".$hash.".doc");
$fp = fopen("done/".$filename, 'w+'); 

$str = '<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:st1="urn:schemas-microsoft-com:office:smarttags"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=ProgId content=Word.Document>

...

 

and then $str is written into the word document.

 

But there's other double and single quotes in there. Do I need to replace them all? I mean I can do this I'm just trying to learn and see if there's a quicker way to accomplish this.

Sorry for sounding like a noob.

-Dan

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.