burger menu icon
WillMaster

WillMaster > LibraryOur Software in Action >  >Master Form V4 in Action

FREE! Coding tips, tricks, and treasures.

Possibilities weekly ezine

Get the weekly email website developers read:

 

Your email address

name@example.com
YES! Send Possibilities every week!

Include a Master Form V4 Database in a Web Page

You've got information that is written to a database from your Master Form V4 program. You would like for that information to appear on a web page. But how do you get it to appear within a web page that matches the look and feel of the rest of your website? The solution can be had by using one of three options: JavaScript, PHP, or SSI.

JavaScript

The first step is to create a form that will collect the information you want written to a database. Once you create the Master Form V4 form, create two hidden form fields, the filetemplate and dbfile:

<input type="hidden" name="filetemplate" value="mf4/subdirectory/webpagedbTemplate.txt">

This file is located in a subdirectory of your Master Form V4 installation.

<input type="hidden" name="dbfile" value="/subdirectory/webpagedbinfo.js">

This can be anywhere on your server. This is the file that will be included within the web page.

In this example, the web page includes a table with the information from the database.

The first thing we do is format a filetemplate so that it will fit into the shell of the web page.

Because we are using a table in this example, we will separate our form fields using the td tag:

<td>[[formfield1]]</td>
<td>[[formfield2]]</td>
<td>[[formfield3]]</td>

This is a JavaScript file, so there is one more step to creating the template and that is convert it from text to JavaScript. Click here for a handy tool to do that.

It will look like this:

document.writeln('<td>[[formfield1]]</td>');
document.writeln('<td>[[formfield2]]</td>');
document.writeln('<td>[[formfield3]]</td>');

Save this as webpagedbTemplate.txt and upload to the folder as indicated in the filetemplate hidden field.

Here is the shell for the web page with the JavaScript File:

<html> 
<head>
<title>Web Page With A Database Example</title>
</head> 
<body>

<table border="0" cellspacing="0" cellpadding="0" width="100%">
 <tr>
<td>Form Field 1 Title</td>
<td>Form Field 2 Title</td>
<td>Form Field 3 Title</td>
</tr>
<tr>
<script type="text/javascript" language="JavaScript" src="https://YourDomain.com/subdirectory/webpagedbinfo.js"> </script>
 </tr>
</table>

</body>
</html>

PHP

Before proceeding with the PHP example, please read this article on how to run PHP on non-PHP web pages.

The first step is to create a form that will collect the information you want written to your database. Once you create your Master Form V4 form, we will create two hidden form fields, the filetemplate and dbfile:

<input type="hidden" name="filetemplate" value="mf4/subdirectory/webpagedbTemplate.txt">

This file is located in a subdirectory of your Master Form V4 installation.

<input type="hidden" name="dbfile" value="/subdirectory/wepagedbinfo.html">

This can be anywhere on your server. This is the file that will be included within the web page.

In this example, the web page includes a table with the information from the database.

The first thing we do is format a filetemplate so that it will fit into the shell of the web page.

Because we are using a table in this example, we will separate our form fields using the td tag:

<td>[[formfield1]]</td>
<td>[[formfield2]]</td>
<td>[[formfield3]]</td>

Save the above as webpagedbTemplate.txt and upload to the folder as indicated in the filetemplate hidden field.

Here is the shell for the web page with the PHP File:

<html> 
<head>
<title>Web Page With A Database Example</title>
</head> 
<body>

<table border="0" cellspacing="0" cellpadding="0" width="100%">
 <tr>
<td>Form Field 1 Title</td>
<td>Form Field 2 Title</td>
<td>Form Field 3 Title</td>
</tr>
<tr>
<?php
@readfile("/subdirectory/webpagedbinfo.html");
?> 
 </tr>
</table>

</body>
</html>

SSI

The first step is to create a form that will collect the information you want written to your database. Once you create your Master Form V4 form, we will create two hidden form fields, the filetemplate and dbfile:

<input type="hidden" name="filetemplate" value="mf4/subdirectory/webpagedbTemplate.txt">

This file is located in a subdirectory of your Master Form V4 installation.

<input type="hidden" name="dbfile" value="/subdirectory/webpagedbinfo.txt">

This can be anywhere on your server. This is the file that will be included within the web page.

In this example, the web page includes a table with the information from the database.

The first thing we do is format a filetemplate so that it will fit into the shell of the web page.

Because we are using a table in this example, we will separate our form fields using the td tag:

<td>[[formfield1]]</td>
<td>[[formfield2]]</td>
<td>[[formfield3]]</td>

Save the above as webpagedbTemplate.txt and upload to the folder as indicated in the filetemplate hidden field.

Here is the shell for the web page with the SSI File:

<html> 
<head>
<title>Web Page With A Database Example</title>
</head> 
<body>

<table border="0" cellspacing="0" cellpadding="0" width="100%">
 <tr>
<td>Form Field 1 Title</td>
<td>Form Field 2 Title</td>
<td>Form Field 3 Title</td>
</tr>
<tr>
<!--#include file="/subdirectory/webpagedbinfo.txt"-->
 </tr>
</table>

</body>
</html>

There you have it. Three efficient ways to include your Master Form V4 created databases within your web pages. This example is more suited for small databases and tabular data, but you can use html code to structure the information as you want it presented.

Jackie McCutcheon

Was this article helpful to you?
(anonymous form)

Support This Website

Some of our support is from people like you who see the value of all that's offered for FREE at this website.

"Yes, let me contribute."

Amount (USD):

Tap to Choose
Contribution
Method

All information in WillMaster Library articles is presented AS-IS.

Support Area – Ask Your Question Here

The "Code in articles help" forum at the Willmaster.com support area is the place to get information about implementing JavaScript and other software code found on Willmaster.com

We only suggest and recommend what we believe is of value. As remuneration for the time and research involved to provide quality links, we generally use affiliate links when we can. Whenever we link to something not our own, you should assume they are affiliate links or that we benefit in some way.

Need Custom Software?
Click to
tell us about
your project.

How Can We Help You? balloons
How Can We Help You?
bullet Custom Programming
bullet Ready-Made Software
bullet Technical Support
bullet Possibilities Newsletter
bullet Website "How-To" Info
bullet Useful Information List

© 1998-2001 William and Mari Bontrager
© 2001-2011 Bontrager Connection, LLC
© 2011-2026 Will Bontrager Software LLC