danhere Posted June 25, 2008 Share Posted June 25, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/111905-using-a-preexisting-word-document-with-a-form/ Share on other sites More sharing options...
.josh Posted June 25, 2008 Share Posted June 25, 2008 sounds like you possibly didn't escape quotes right or used single quotes around your variable. Using single quotes around a variable causes it to be interpreted literally. You need to post some code. Quote Link to comment https://forums.phpfreaks.com/topic/111905-using-a-preexisting-word-document-with-a-form/#findComment-574382 Share on other sites More sharing options...
danhere Posted June 25, 2008 Author Share Posted June 25, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/111905-using-a-preexisting-word-document-with-a-form/#findComment-574389 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.