html page
- mase
- Newbie


- Joined: Jan 27, 2009
- Posts: 6
- Status: Offline
Need some help, trying creating an html page for and end user to type in the following info...
Address, name and zip code… after hitting submit it will populate to a word template (standard letter) with the fields address, name and zip code… it will place what they type in the html web page to the word doc… and open the word doc so they can print…
I am lost…
Any help will be much appreciated.
Thanks.
mase
Address, name and zip code… after hitting submit it will populate to a word template (standard letter) with the fields address, name and zip code… it will place what they type in the html web page to the word doc… and open the word doc so they can print…
I am lost…
Any help will be much appreciated.
Thanks.
mase
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
January 27th, 2009, 6:32 pm
- alex89
- Bronze Member


- Joined: Jul 18, 2008
- Posts: 239
- Loc: Western Australia
- Status: Offline
Well, you've come to the right place 
Firstly, you need 2 files.
1: A html page (index.html, say), that the user writes the address and everything in. You'll need to create a form using input boxes (google "html form" for more information.
See above under action it says "post.php"? That means that the html page will send the information in the form to the php page, for you to do things with.
2: That brings me to the second file, a php file. (I think php is the easiest way to do this, probably not the only solution.)
The php file needs to retrieve the information that's sent to it, and that's by using $_POST["address"]
You'll need to do something like this:
That'll display the address that the php file has been sent. When you've got the above two files working, try replaceing the 2nd file with the following code.
(This creates a word document called alex.doc, and should put the text "The address is $address" into it.)
You'll need to upload these both to a server with php and all the usual things installed. Have a play around - see how you go.
Firstly, you need 2 files.
1: A html page (index.html, say), that the user writes the address and everything in. You'll need to create a form using input boxes (google "html form" for more information.
Code: [ Select ]
<form name="form1" method="post" action="post.php">
Address: <input type="text" name="address" id="address">
</form>
Address: <input type="text" name="address" id="address">
</form>
- <form name="form1" method="post" action="post.php">
- Address: <input type="text" name="address" id="address">
- </form>
See above under action it says "post.php"? That means that the html page will send the information in the form to the php page, for you to do things with.
2: That brings me to the second file, a php file. (I think php is the easiest way to do this, probably not the only solution.)
The php file needs to retrieve the information that's sent to it, and that's by using $_POST["address"]
You'll need to do something like this:
Code: [ Select ]
<?php
$address = $_POST["address"];
echo $address;
?>
$address = $_POST["address"];
echo $address;
?>
- <?php
- $address = $_POST["address"];
- echo $address;
- ?>
That'll display the address that the php file has been sent. When you've got the above two files working, try replaceing the 2nd file with the following code.
(This creates a word document called alex.doc, and should put the text "The address is $address" into it.)
Code: [ Select ]
<?php
$fp = fopen("alex.doc", 'w+');
$str = "<b>The address is ".%address.".</b>"
fwrite($fp, $str);
fclose($fp);
?>
$fp = fopen("alex.doc", 'w+');
$str = "<b>The address is ".%address.".</b>"
fwrite($fp, $str);
fclose($fp);
?>
- <?php
- $fp = fopen("alex.doc", 'w+');
- $str = "<b>The address is ".%address.".</b>"
- fwrite($fp, $str);
- fclose($fp);
- ?>
You'll need to upload these both to a server with php and all the usual things installed. Have a play around - see how you go.
- mase
- Newbie


- Joined: Jan 27, 2009
- Posts: 6
- Status: Offline
- alex89
- Bronze Member


- Joined: Jul 18, 2008
- Posts: 239
- Loc: Western Australia
- Status: Offline
Yeah, like this:
then in the php file:
Or however you want. If you give me a rough format for your letter I'll help out with the template
Code: [ Select ]
<form name="form1" method="post" action="post.php">
Address: <input type="text" name="address" id="address">
<input type="text" name="housenumber" id="housenumber">
<input type="text" name="state" id="state">
<input type="text" name="postcode" id="postcode">
</form>
Address: <input type="text" name="address" id="address">
<input type="text" name="housenumber" id="housenumber">
<input type="text" name="state" id="state">
<input type="text" name="postcode" id="postcode">
</form>
- <form name="form1" method="post" action="post.php">
- Address: <input type="text" name="address" id="address">
- <input type="text" name="housenumber" id="housenumber">
- <input type="text" name="state" id="state">
- <input type="text" name="postcode" id="postcode">
- </form>
then in the php file:
Code: [ Select ]
<?php
$address = $_POST["address"];
$number= $_POST["housenumber"];
$state = $_POST["state"];
$postcode = $_POST["postcode"];
echo $address;
echo "<br />";
echo $number;
echo "<br />";
echo $state;
echo "<br />";
echo $postcode;
?>
$address = $_POST["address"];
$number= $_POST["housenumber"];
$state = $_POST["state"];
$postcode = $_POST["postcode"];
echo $address;
echo "<br />";
echo $number;
echo "<br />";
echo $state;
echo "<br />";
echo $postcode;
?>
- <?php
- $address = $_POST["address"];
- $number= $_POST["housenumber"];
- $state = $_POST["state"];
- $postcode = $_POST["postcode"];
- echo $address;
- echo "<br />";
- echo $number;
- echo "<br />";
- echo $state;
- echo "<br />";
- echo $postcode;
- ?>
Or however you want. If you give me a rough format for your letter I'll help out with the template
- mase
- Newbie


- Joined: Jan 27, 2009
- Posts: 6
- Status: Offline
- mase
- Newbie


- Joined: Jan 27, 2009
- Posts: 6
- Status: Offline
Hi alax89 need some help.
i get a blank web page.
and word don't open up... i up load the file a server that uses php.
file one mailmerge.html,post.php and hwpt2.doc.
in the word tmeplaet the area to fill look like this, i use mail merge wizard to do this. this is a pre-type letter.
«Date»
To: «Company_Name»
«Address»
«City», «State» «ZIP_Code»
please take a look at my code and see whare i went wrong.
post.php (codes)
i get a blank web page.
and word don't open up... i up load the file a server that uses php.
file one mailmerge.html,post.php and hwpt2.doc.
in the word tmeplaet the area to fill look like this, i use mail merge wizard to do this. this is a pre-type letter.
«Date»
To: «Company_Name»
«Address»
«City», «State» «ZIP_Code»
please take a look at my code and see whare i went wrong.
post.php (codes)
Code: [ Select ]
<?php
$Date =$_POST ["Date"];
$Amount = $_POST ["Amount"];
$Company_Name = $_POST ["Company_Name"];
$Address = $_POST["Address"];
$City= $_POST["City"];
$State = $_POST["State"];
$ZIP_Code = $_POST["ZIP_Code"];
$Specialists_Name = $_POST ["Specialists_Name"];
$Ext = $_POST ["Ext"];
$Cell = $_POST ["Cell"];
$Agent = $_POST ["Agent"];
$No_1 = $_POST ["No_1"];
$No_2 = $_POST ["No_2"];
$No_3 = $_POST ["No_3"];
$Total_Payments = $_POST ["Total_Payments"];
echo $Date;
echo "<br />";
echo $Amount;
echo "<br />";
echo $Company_Name;
echo "<br />";
echo $Address;
echo "<br />";
echo $City;
echo "<br />"
echo $State;
echo "<br />";
echo $ZIP_Code;
echo "<br />";
echo $Specialists_Name;
echo "<br />";
echo $Ext;
echo "<br />"
echo $Cell;
echo "<br />";
echo $Agent;
echo "<br />";
echo $No_1;
echo "<br />";
echo $No_2;
echo "<br />";
echo $No_3;
echo $Total_Payments
$fp = fopen("HWPT2.doc", 'w+');
fwrite($fp, $str);
fclose($fp);
?>
mailmerge.html (code)
<HTML>
<HEAD>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta name="generator" content="Web Page Maker">
</HEAD>
<BODY bgColor="#808080">
<form name="form1" method="post" action="post.php">
<div style="position:absolute; overflow:hidden; left:219px; top:243px; width:45px; height:22px; z-index:15">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Date:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:368px; top:243px; width:54px; height:22px; z-index:16">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Amount:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:217px; top:188px; width:461px; height:494px; z-index:0; background-color:#C0C0C0">
</DIV>
<div style="position:absolute; overflow:hidden; left:219px; top:291px; width:100px; height:22px; z-index:18">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Company Name:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:261px; top:325px; width:55px; height:22px; z-index:19">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Address:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:287px; top:355px; width:30px; height:22px; z-index:20">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>City:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:426px; top:355px; width:45px; height:22px; z-index:21">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>State:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:515px; top:356px; width:64px; height:22px; z-index:22">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Zip Code:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:218px; top:415px; width:104px; height:22px; z-index:23">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Specialists Name:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:223px; top:450px; width:103px; height:22px; z-index:24">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Phone Extension:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:446px; top:450px; width:33px; height:22px; z-index:25">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Cell:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:321px; top:487px; width:93px; height:22px; z-index:26">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Agent Number:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:239px; top:576px; width:45px; height:22px; z-index:27">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>NO. 1:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:383px; top:541px; width:122px; height:22px; z-index:28">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV><FONT style="font-size:12pt"><B>Payment Info</B></FONT></DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:379px; top:576px; width:45px; height:22px; z-index:29">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>NO. 2:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:539px; top:575px; width:45px; height:22px; z-index:30">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>NO. 3:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:323px; top:627px; width:94px; height:22px; z-index:31">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Total Payment:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:327px; top:163px; width:253px; height:23px; z-index:32">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV><FONT style="font-size:11pt"><B>WELCOM PACKAGE MAIL MERGE</B></FONT></DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:230px; top:27px; width:306px; height:105px; z-index:33"><img width=306 height=105 border=0 src="images/homesavers1.bmp"></DIV>
<div style="position:absolute; overflow:hidden; left:536px; top:81px; width:131px; height:52px; z-index:34"><img width=131 height=52 border=0 src="images/permid.bmp"></DIV>
<div style="position:absolute; overflow:hidden; left:521px; top:132px; width:150px; height:30px; z-index:35">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV><FONT style="font-size:16pt"><B>Rescue Group</B></FONT></DIV>
</FONT>
</DIV>
<input name="$Date" type="text" style="position:absolute;width:110px;left:253px;top:240px;z-index:1">
<input name="$Amount" value="$" type="text" style="position:absolute;width:149px;left:418px;top:239px;z-index:2">
<input name="$City" type="text" style="position:absolute;width:110px;left:313px;top:351px;z-index:3">
<input name="$Address" type="text" style="position:absolute;width:200px;left:314px;top:322px;z-index:4">
<input name="$State" type="text" style="position:absolute;width:52px;left:461px;top:352px;z-index:5">
<input name="$ZIP_Code" type="text" style="position:absolute;width:78px;left:570px;top:353px;z-index:6">
<input name="$Specialists_Name" type="text" style="position:absolute;width:213px;left:321px;top:412px;z-index:7">
<input name="$Ext" type="text" style="position:absolute;width:104px;left:321px;top:447px;z-index:8">
<input name="$Cell" type="text" style="position:absolute;width:153px;left:474px;top:447px;z-index:9">
<input name="$Agent" type="text" style="position:absolute;width:65px;left:413px;top:483px;z-index:10">
<input name="$No_1" value="$" type="text" style="position:absolute;width:88px;left:283px;top:572px;z-index:11">
<input name="$No_2" value="$" type="text" style="position:absolute;width:107px;left:424px;top:572px;z-index:12">
<input name="$No_3" value="$" type="text" style="position:absolute;width:90px;left:581px;top:570px;z-index:13">
<input name="$Total_Payments" type="text" style="position:absolute;width:99px;left:417px;top:623px;z-index:14">
<input name="$Company_Name" type="text" style="position:absolute;width:252px;left:315px;top:288px;z-index:17">
<input type="submit" value="Submit Query" style="position:absolute;left:558px;top:656px;z-index:36">
</form>
</BODY>
</HTML>
$Date =$_POST ["Date"];
$Amount = $_POST ["Amount"];
$Company_Name = $_POST ["Company_Name"];
$Address = $_POST["Address"];
$City= $_POST["City"];
$State = $_POST["State"];
$ZIP_Code = $_POST["ZIP_Code"];
$Specialists_Name = $_POST ["Specialists_Name"];
$Ext = $_POST ["Ext"];
$Cell = $_POST ["Cell"];
$Agent = $_POST ["Agent"];
$No_1 = $_POST ["No_1"];
$No_2 = $_POST ["No_2"];
$No_3 = $_POST ["No_3"];
$Total_Payments = $_POST ["Total_Payments"];
echo $Date;
echo "<br />";
echo $Amount;
echo "<br />";
echo $Company_Name;
echo "<br />";
echo $Address;
echo "<br />";
echo $City;
echo "<br />"
echo $State;
echo "<br />";
echo $ZIP_Code;
echo "<br />";
echo $Specialists_Name;
echo "<br />";
echo $Ext;
echo "<br />"
echo $Cell;
echo "<br />";
echo $Agent;
echo "<br />";
echo $No_1;
echo "<br />";
echo $No_2;
echo "<br />";
echo $No_3;
echo $Total_Payments
$fp = fopen("HWPT2.doc", 'w+');
fwrite($fp, $str);
fclose($fp);
?>
mailmerge.html (code)
<HTML>
<HEAD>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta name="generator" content="Web Page Maker">
</HEAD>
<BODY bgColor="#808080">
<form name="form1" method="post" action="post.php">
<div style="position:absolute; overflow:hidden; left:219px; top:243px; width:45px; height:22px; z-index:15">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Date:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:368px; top:243px; width:54px; height:22px; z-index:16">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Amount:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:217px; top:188px; width:461px; height:494px; z-index:0; background-color:#C0C0C0">
</DIV>
<div style="position:absolute; overflow:hidden; left:219px; top:291px; width:100px; height:22px; z-index:18">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Company Name:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:261px; top:325px; width:55px; height:22px; z-index:19">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Address:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:287px; top:355px; width:30px; height:22px; z-index:20">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>City:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:426px; top:355px; width:45px; height:22px; z-index:21">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>State:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:515px; top:356px; width:64px; height:22px; z-index:22">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Zip Code:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:218px; top:415px; width:104px; height:22px; z-index:23">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Specialists Name:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:223px; top:450px; width:103px; height:22px; z-index:24">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Phone Extension:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:446px; top:450px; width:33px; height:22px; z-index:25">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Cell:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:321px; top:487px; width:93px; height:22px; z-index:26">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Agent Number:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:239px; top:576px; width:45px; height:22px; z-index:27">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>NO. 1:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:383px; top:541px; width:122px; height:22px; z-index:28">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV><FONT style="font-size:12pt"><B>Payment Info</B></FONT></DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:379px; top:576px; width:45px; height:22px; z-index:29">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>NO. 2:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:539px; top:575px; width:45px; height:22px; z-index:30">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>NO. 3:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:323px; top:627px; width:94px; height:22px; z-index:31">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV>Total Payment:</DIV>
<DIV> </DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:327px; top:163px; width:253px; height:23px; z-index:32">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV><FONT style="font-size:11pt"><B>WELCOM PACKAGE MAIL MERGE</B></FONT></DIV>
</FONT>
</DIV>
<div style="position:absolute; overflow:hidden; left:230px; top:27px; width:306px; height:105px; z-index:33"><img width=306 height=105 border=0 src="images/homesavers1.bmp"></DIV>
<div style="position:absolute; overflow:hidden; left:536px; top:81px; width:131px; height:52px; z-index:34"><img width=131 height=52 border=0 src="images/permid.bmp"></DIV>
<div style="position:absolute; overflow:hidden; left:521px; top:132px; width:150px; height:30px; z-index:35">
<FONT style="font-size:10pt" color=#000000 face="Tahoma">
<DIV><FONT style="font-size:16pt"><B>Rescue Group</B></FONT></DIV>
</FONT>
</DIV>
<input name="$Date" type="text" style="position:absolute;width:110px;left:253px;top:240px;z-index:1">
<input name="$Amount" value="$" type="text" style="position:absolute;width:149px;left:418px;top:239px;z-index:2">
<input name="$City" type="text" style="position:absolute;width:110px;left:313px;top:351px;z-index:3">
<input name="$Address" type="text" style="position:absolute;width:200px;left:314px;top:322px;z-index:4">
<input name="$State" type="text" style="position:absolute;width:52px;left:461px;top:352px;z-index:5">
<input name="$ZIP_Code" type="text" style="position:absolute;width:78px;left:570px;top:353px;z-index:6">
<input name="$Specialists_Name" type="text" style="position:absolute;width:213px;left:321px;top:412px;z-index:7">
<input name="$Ext" type="text" style="position:absolute;width:104px;left:321px;top:447px;z-index:8">
<input name="$Cell" type="text" style="position:absolute;width:153px;left:474px;top:447px;z-index:9">
<input name="$Agent" type="text" style="position:absolute;width:65px;left:413px;top:483px;z-index:10">
<input name="$No_1" value="$" type="text" style="position:absolute;width:88px;left:283px;top:572px;z-index:11">
<input name="$No_2" value="$" type="text" style="position:absolute;width:107px;left:424px;top:572px;z-index:12">
<input name="$No_3" value="$" type="text" style="position:absolute;width:90px;left:581px;top:570px;z-index:13">
<input name="$Total_Payments" type="text" style="position:absolute;width:99px;left:417px;top:623px;z-index:14">
<input name="$Company_Name" type="text" style="position:absolute;width:252px;left:315px;top:288px;z-index:17">
<input type="submit" value="Submit Query" style="position:absolute;left:558px;top:656px;z-index:36">
</form>
</BODY>
</HTML>
- <?php
- $Date =$_POST ["Date"];
- $Amount = $_POST ["Amount"];
- $Company_Name = $_POST ["Company_Name"];
- $Address = $_POST["Address"];
- $City= $_POST["City"];
- $State = $_POST["State"];
- $ZIP_Code = $_POST["ZIP_Code"];
- $Specialists_Name = $_POST ["Specialists_Name"];
- $Ext = $_POST ["Ext"];
- $Cell = $_POST ["Cell"];
- $Agent = $_POST ["Agent"];
- $No_1 = $_POST ["No_1"];
- $No_2 = $_POST ["No_2"];
- $No_3 = $_POST ["No_3"];
- $Total_Payments = $_POST ["Total_Payments"];
- echo $Date;
- echo "<br />";
- echo $Amount;
- echo "<br />";
- echo $Company_Name;
- echo "<br />";
- echo $Address;
- echo "<br />";
- echo $City;
- echo "<br />"
- echo $State;
- echo "<br />";
- echo $ZIP_Code;
- echo "<br />";
- echo $Specialists_Name;
- echo "<br />";
- echo $Ext;
- echo "<br />"
- echo $Cell;
- echo "<br />";
- echo $Agent;
- echo "<br />";
- echo $No_1;
- echo "<br />";
- echo $No_2;
- echo "<br />";
- echo $No_3;
- echo $Total_Payments
- $fp = fopen("HWPT2.doc", 'w+');
- fwrite($fp, $str);
- fclose($fp);
- ?>
- mailmerge.html (code)
- <HTML>
- <HEAD>
- <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
- <meta name="generator" content="Web Page Maker">
- </HEAD>
- <BODY bgColor="#808080">
- <form name="form1" method="post" action="post.php">
- <div style="position:absolute; overflow:hidden; left:219px; top:243px; width:45px; height:22px; z-index:15">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>Date:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:368px; top:243px; width:54px; height:22px; z-index:16">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>Amount:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:217px; top:188px; width:461px; height:494px; z-index:0; background-color:#C0C0C0">
- </DIV>
- <div style="position:absolute; overflow:hidden; left:219px; top:291px; width:100px; height:22px; z-index:18">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>Company Name:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:261px; top:325px; width:55px; height:22px; z-index:19">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>Address:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:287px; top:355px; width:30px; height:22px; z-index:20">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>City:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:426px; top:355px; width:45px; height:22px; z-index:21">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>State:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:515px; top:356px; width:64px; height:22px; z-index:22">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>Zip Code:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:218px; top:415px; width:104px; height:22px; z-index:23">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>Specialists Name:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:223px; top:450px; width:103px; height:22px; z-index:24">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>Phone Extension:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:446px; top:450px; width:33px; height:22px; z-index:25">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>Cell:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:321px; top:487px; width:93px; height:22px; z-index:26">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>Agent Number:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:239px; top:576px; width:45px; height:22px; z-index:27">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>NO. 1:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:383px; top:541px; width:122px; height:22px; z-index:28">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV><FONT style="font-size:12pt"><B>Payment Info</B></FONT></DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:379px; top:576px; width:45px; height:22px; z-index:29">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>NO. 2:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:539px; top:575px; width:45px; height:22px; z-index:30">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>NO. 3:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:323px; top:627px; width:94px; height:22px; z-index:31">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV>Total Payment:</DIV>
- <DIV> </DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:327px; top:163px; width:253px; height:23px; z-index:32">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV><FONT style="font-size:11pt"><B>WELCOM PACKAGE MAIL MERGE</B></FONT></DIV>
- </FONT>
- </DIV>
- <div style="position:absolute; overflow:hidden; left:230px; top:27px; width:306px; height:105px; z-index:33"><img width=306 height=105 border=0 src="images/homesavers1.bmp"></DIV>
- <div style="position:absolute; overflow:hidden; left:536px; top:81px; width:131px; height:52px; z-index:34"><img width=131 height=52 border=0 src="images/permid.bmp"></DIV>
- <div style="position:absolute; overflow:hidden; left:521px; top:132px; width:150px; height:30px; z-index:35">
- <FONT style="font-size:10pt" color=#000000 face="Tahoma">
- <DIV><FONT style="font-size:16pt"><B>Rescue Group</B></FONT></DIV>
- </FONT>
- </DIV>
- <input name="$Date" type="text" style="position:absolute;width:110px;left:253px;top:240px;z-index:1">
- <input name="$Amount" value="$" type="text" style="position:absolute;width:149px;left:418px;top:239px;z-index:2">
- <input name="$City" type="text" style="position:absolute;width:110px;left:313px;top:351px;z-index:3">
- <input name="$Address" type="text" style="position:absolute;width:200px;left:314px;top:322px;z-index:4">
- <input name="$State" type="text" style="position:absolute;width:52px;left:461px;top:352px;z-index:5">
- <input name="$ZIP_Code" type="text" style="position:absolute;width:78px;left:570px;top:353px;z-index:6">
- <input name="$Specialists_Name" type="text" style="position:absolute;width:213px;left:321px;top:412px;z-index:7">
- <input name="$Ext" type="text" style="position:absolute;width:104px;left:321px;top:447px;z-index:8">
- <input name="$Cell" type="text" style="position:absolute;width:153px;left:474px;top:447px;z-index:9">
- <input name="$Agent" type="text" style="position:absolute;width:65px;left:413px;top:483px;z-index:10">
- <input name="$No_1" value="$" type="text" style="position:absolute;width:88px;left:283px;top:572px;z-index:11">
- <input name="$No_2" value="$" type="text" style="position:absolute;width:107px;left:424px;top:572px;z-index:12">
- <input name="$No_3" value="$" type="text" style="position:absolute;width:90px;left:581px;top:570px;z-index:13">
- <input name="$Total_Payments" type="text" style="position:absolute;width:99px;left:417px;top:623px;z-index:14">
- <input name="$Company_Name" type="text" style="position:absolute;width:252px;left:315px;top:288px;z-index:17">
- <input type="submit" value="Submit Query" style="position:absolute;left:558px;top:656px;z-index:36">
- </form>
- </BODY>
- </HTML>
Moderator Remark: Code tags added
- Bogey
- Bogey


- Joined: Jul 14, 2005
- Posts: 8211
- Loc: USA
- Status: Offline
Your doing it wrong... Alex didn't tell you the bigger part of it... he just told you the very basics and assumed you knew how to fill in the blanks.
Here is what I did that should work. I haven't tested it since I don't have Microsoft Word so I can't test it, but here is the untested function. I don't know if it'll work because of the headers... I could take more time and create a full functional function to do what you want which would force you to download the document with the headers in place, but I don't have any desire to.
Try that and tell me what you get.
Here is what I did that should work. I haven't tested it since I don't have Microsoft Word so I can't test it, but here is the untested function. I don't know if it'll work because of the headers... I could take more time and create a full functional function to do what you want which would force you to download the document with the headers in place, but I don't have any desire to.
PHP Code: [ Select ]
<?php
$Date = $_POST ["Date"];
$Amount = $_POST ["Amount"];
$Company_Name = $_POST ["Company_Name"];
$Address = $_POST["Address"];
$City= $_POST["City"];
$State = $_POST["State"];
$ZIP_Code = $_POST["ZIP_Code"];
$Specialists_Name = $_POST ["Specialists_Name"];
$Ext = $_POST ["Ext"];
$Cell = $_POST ["Cell"];
$Agent = $_POST ["Agent"];
$No_1 = $_POST ["No_1"];
$No_2 = $_POST ["No_2"];
$No_3 = $_POST ["No_3"];
$Total_Payments = $_POST ["Total_Payments"];
if(fopen("HWPT2.doc", 'r+'))
{
$filesize = filesize('HWPT2.doc');
$str = fread('HWPT2.doc', $filesize);
$str = str_replace("«Date»",$Date,$str);
$str = str_replace("«Company_Name»",$Company_Name,$str);
$str = str_replace("«Address» ",$Address,$str);
$str = str_replace("«City»", $City,$str);
$str = str_replace("«State»", $State,$str);
$str = str_replace("«ZIP_Code»",$ZIP_Code,$str);
if(fwrite($fp, $str))
{
echo 'File created successfully';
}
fclose($fp);
}
else
{
echo 'Failed to retrieve the page';
}
?>
$Date = $_POST ["Date"];
$Amount = $_POST ["Amount"];
$Company_Name = $_POST ["Company_Name"];
$Address = $_POST["Address"];
$City= $_POST["City"];
$State = $_POST["State"];
$ZIP_Code = $_POST["ZIP_Code"];
$Specialists_Name = $_POST ["Specialists_Name"];
$Ext = $_POST ["Ext"];
$Cell = $_POST ["Cell"];
$Agent = $_POST ["Agent"];
$No_1 = $_POST ["No_1"];
$No_2 = $_POST ["No_2"];
$No_3 = $_POST ["No_3"];
$Total_Payments = $_POST ["Total_Payments"];
if(fopen("HWPT2.doc", 'r+'))
{
$filesize = filesize('HWPT2.doc');
$str = fread('HWPT2.doc', $filesize);
$str = str_replace("«Date»",$Date,$str);
$str = str_replace("«Company_Name»",$Company_Name,$str);
$str = str_replace("«Address» ",$Address,$str);
$str = str_replace("«City»", $City,$str);
$str = str_replace("«State»", $State,$str);
$str = str_replace("«ZIP_Code»",$ZIP_Code,$str);
if(fwrite($fp, $str))
{
echo 'File created successfully';
}
fclose($fp);
}
else
{
echo 'Failed to retrieve the page';
}
?>
- <?php
- $Date = $_POST ["Date"];
- $Amount = $_POST ["Amount"];
- $Company_Name = $_POST ["Company_Name"];
- $Address = $_POST["Address"];
- $City= $_POST["City"];
- $State = $_POST["State"];
- $ZIP_Code = $_POST["ZIP_Code"];
- $Specialists_Name = $_POST ["Specialists_Name"];
- $Ext = $_POST ["Ext"];
- $Cell = $_POST ["Cell"];
- $Agent = $_POST ["Agent"];
- $No_1 = $_POST ["No_1"];
- $No_2 = $_POST ["No_2"];
- $No_3 = $_POST ["No_3"];
- $Total_Payments = $_POST ["Total_Payments"];
- if(fopen("HWPT2.doc", 'r+'))
- {
- $filesize = filesize('HWPT2.doc');
- $str = fread('HWPT2.doc', $filesize);
- $str = str_replace("«Date»",$Date,$str);
- $str = str_replace("«Company_Name»",$Company_Name,$str);
- $str = str_replace("«Address» ",$Address,$str);
- $str = str_replace("«City»", $City,$str);
- $str = str_replace("«State»", $State,$str);
- $str = str_replace("«ZIP_Code»",$ZIP_Code,$str);
- if(fwrite($fp, $str))
- {
- echo 'File created successfully';
- }
- fclose($fp);
- }
- else
- {
- echo 'Failed to retrieve the page';
- }
- ?>
Try that and tell me what you get.
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
- mase
- Newbie


- Joined: Jan 27, 2009
- Posts: 6
- Status: Offline
- Bogey
- Bogey


- Joined: Jul 14, 2005
- Posts: 8211
- Loc: USA
- Status: Offline
- alex89
- Bronze Member


- Joined: Jul 18, 2008
- Posts: 239
- Loc: Western Australia
- Status: Offline
- Bogey
- Bogey


- Joined: Jul 14, 2005
- Posts: 8211
- Loc: USA
- Status: Offline
- mase
- Newbie


- Joined: Jan 27, 2009
- Posts: 6
- Status: Offline
Thanks Bogey and Alex89 for all your help but i can't get this thing to work, i get a blank back. on the bottom is say done... will not open up the doc. file nor change it... code are
post.php
mail.html
i am trying to edit jest those area for now... to see how it works.
post.php
Code: [ Select ]
<?php
$Date =$_POST ["Date"];
$Amount = $_POST ["Amount"];
$Company_Name = $_POST ["Company_Name"];
$Address = $_POST["Address"];
$City= $_POST["City"];
$State = $_POST["State"];
$ZIP_Code = $_POST["ZIP_Code"];
$Specialists_Name = $_POST ["Specialists_Name"];
$Ext = $_POST ["Ext"];
$Cell = $_POST ["Cell"];
$Agent = $_POST ["Agent"];
$No_1 = $_POST ["No_1"];
$No_2 = $_POST ["No_2"];
$No_3 = $_POST ["No_3"];
$Total_Payments = $_POST ["Total_Payments"];
if(fopen("HWPT2.doc", 'r+'))
{
$filesize = filesize('HWPT2.doc');
$str = fread('HWPT2.doc', $filesize);
$str = str_replace("«Date»",$Date,$str);
$str = str_replace("«Amount»",$Amount,$str);
$str = str_replace("«Company_Name»",$Company_Name,$str);
$str = str_replace("«Address» ",$Address,$str);
$str = str_replace("«City»", $City,$str);
$str = str_replace("«State»", $State,$str);
$str = str_replace("«ZIP_Code»",$ZIP_Code,$str);
$str = str_replace("«Specialists_Name»",$Specialists_Name,$str);
$str = str_replace("«Ext»",$Ext,$str);
$str = str_replace("«Cell»",$Cell,$str);
$str = str_replace("«Agent»",$Agent,$str);
$str = str_replace("«No_1»",$No_1,$str);
$str = str_replace("«No_2»",$No_2,$str);
$str = str_replace("«No_3»",$No_3,$str);
$str = str_replace("«Total_Payments»",$Total_Payments,$str);
if(fwrite($fp, $str))
{
echo 'File created successfully';
}
fclose($fp);
}
else
{
echo 'Failed to retrieve the page';
}
?>
$Date =$_POST ["Date"];
$Amount = $_POST ["Amount"];
$Company_Name = $_POST ["Company_Name"];
$Address = $_POST["Address"];
$City= $_POST["City"];
$State = $_POST["State"];
$ZIP_Code = $_POST["ZIP_Code"];
$Specialists_Name = $_POST ["Specialists_Name"];
$Ext = $_POST ["Ext"];
$Cell = $_POST ["Cell"];
$Agent = $_POST ["Agent"];
$No_1 = $_POST ["No_1"];
$No_2 = $_POST ["No_2"];
$No_3 = $_POST ["No_3"];
$Total_Payments = $_POST ["Total_Payments"];
if(fopen("HWPT2.doc", 'r+'))
{
$filesize = filesize('HWPT2.doc');
$str = fread('HWPT2.doc', $filesize);
$str = str_replace("«Date»",$Date,$str);
$str = str_replace("«Amount»",$Amount,$str);
$str = str_replace("«Company_Name»",$Company_Name,$str);
$str = str_replace("«Address» ",$Address,$str);
$str = str_replace("«City»", $City,$str);
$str = str_replace("«State»", $State,$str);
$str = str_replace("«ZIP_Code»",$ZIP_Code,$str);
$str = str_replace("«Specialists_Name»",$Specialists_Name,$str);
$str = str_replace("«Ext»",$Ext,$str);
$str = str_replace("«Cell»",$Cell,$str);
$str = str_replace("«Agent»",$Agent,$str);
$str = str_replace("«No_1»",$No_1,$str);
$str = str_replace("«No_2»",$No_2,$str);
$str = str_replace("«No_3»",$No_3,$str);
$str = str_replace("«Total_Payments»",$Total_Payments,$str);
if(fwrite($fp, $str))
{
echo 'File created successfully';
}
fclose($fp);
}
else
{
echo 'Failed to retrieve the page';
}
?>
- <?php
- $Date =$_POST ["Date"];
- $Amount = $_POST ["Amount"];
- $Company_Name = $_POST ["Company_Name"];
- $Address = $_POST["Address"];
- $City= $_POST["City"];
- $State = $_POST["State"];
- $ZIP_Code = $_POST["ZIP_Code"];
- $Specialists_Name = $_POST ["Specialists_Name"];
- $Ext = $_POST ["Ext"];
- $Cell = $_POST ["Cell"];
- $Agent = $_POST ["Agent"];
- $No_1 = $_POST ["No_1"];
- $No_2 = $_POST ["No_2"];
- $No_3 = $_POST ["No_3"];
- $Total_Payments = $_POST ["Total_Payments"];
- if(fopen("HWPT2.doc", 'r+'))
- {
- $filesize = filesize('HWPT2.doc');
- $str = fread('HWPT2.doc', $filesize);
- $str = str_replace("«Date»",$Date,$str);
- $str = str_replace("«Amount»",$Amount,$str);
- $str = str_replace("«Company_Name»",$Company_Name,$str);
- $str = str_replace("«Address» ",$Address,$str);
- $str = str_replace("«City»", $City,$str);
- $str = str_replace("«State»", $State,$str);
- $str = str_replace("«ZIP_Code»",$ZIP_Code,$str);
- $str = str_replace("«Specialists_Name»",$Specialists_Name,$str);
- $str = str_replace("«Ext»",$Ext,$str);
- $str = str_replace("«Cell»",$Cell,$str);
- $str = str_replace("«Agent»",$Agent,$str);
- $str = str_replace("«No_1»",$No_1,$str);
- $str = str_replace("«No_2»",$No_2,$str);
- $str = str_replace("«No_3»",$No_3,$str);
- $str = str_replace("«Total_Payments»",$Total_Payments,$str);
- if(fwrite($fp, $str))
- {
- echo 'File created successfully';
- }
- fclose($fp);
- }
- else
- {
- echo 'Failed to retrieve the page';
- }
- ?>
mail.html
Code: [ Select ]
<form name="form1" method="post" action="post.php">
Address: <input type="text" name="Aaddress" id="Address">
Company Name: <input type="text" name="Company_Name" id="Company_Name">
State: <input type="text" name="State" id="State">
Zip Code: <input type="text" name="ZIP_Code" id="ZIP_Code">
<INPUT TYPE=SUBMIT>
</form>
Address: <input type="text" name="Aaddress" id="Address">
Company Name: <input type="text" name="Company_Name" id="Company_Name">
State: <input type="text" name="State" id="State">
Zip Code: <input type="text" name="ZIP_Code" id="ZIP_Code">
<INPUT TYPE=SUBMIT>
</form>
- <form name="form1" method="post" action="post.php">
- Address: <input type="text" name="Aaddress" id="Address">
- Company Name: <input type="text" name="Company_Name" id="Company_Name">
- State: <input type="text" name="State" id="State">
- Zip Code: <input type="text" name="ZIP_Code" id="ZIP_Code">
- <INPUT TYPE=SUBMIT>
- </form>
i am trying to edit jest those area for now... to see how it works.
Moderator Remark: Code tags added
- Bogey
- Bogey


- Joined: Jul 14, 2005
- Posts: 8211
- Loc: USA
- Status: Offline
your $fp is not defined...
By the way, add the [code]...[ /code] blocks to your codes before a moderator notices it
(Looking back, I forgot to define that variable in my example above... sorry about that)
Code: [ Select ]
$fp = fopen("HWPT2.doc", 'r+');
if($fp)
{
$filesize = filesize('HWPT2.doc');
$str = fread('HWPT2.doc', $filesize);
// and so on...
if($fp)
{
$filesize = filesize('HWPT2.doc');
$str = fread('HWPT2.doc', $filesize);
// and so on...
- $fp = fopen("HWPT2.doc", 'r+');
- if($fp)
- {
- $filesize = filesize('HWPT2.doc');
- $str = fread('HWPT2.doc', $filesize);
- // and so on...
By the way, add the [code]...[ /code] blocks to your codes before a moderator notices it
(Looking back, I forgot to define that variable in my example above... sorry about that)
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
Page 1 of 1
To Reply to this topic you need to LOGIN or REGISTER. It is free.
Post Information
- Total Posts in this topic: 13 posts
- Users browsing this forum: No registered users and 297 guests
- You cannot post new topics in this forum
- You cannot reply to topics in this forum
- You cannot edit your posts in this forum
- You cannot delete your posts in this forum
- You cannot post attachments in this forum
