Interfacing With Database
Ok, now we can get down to the fun part, interfacing with a database!
We first create 2 php files. One to act as a form to get data from the user and
another to actually process the command. I know there are more elegant ways of
doing this. However, I was after a way which would be the easiest to understand.
another to actually process the command. I know there are more elegant ways of
doing this. However, I was after a way which would be the easiest to understand.
The first PHP file is as follows. It is the form into which the user enters information.
You should be able to copy and paste the code into you favourite editor. You can
call this file whatever you want. I have called it FormInput.php3.
You should be able to copy and paste the code into you favourite editor. You can
call this file whatever you want. I have called it FormInput.php3.
<?php
function HTML_Head() {
echo "
<HTML><HEAD>
<TITLE>Processing Form</TITLE>
</HEAD>
<BODY BGCOLOR="#D5D5AB">";
}
function
HTML_Form() {
echo
"
<FORM NAME = "AccessInterface" METHOD=post ACTION="DataAccess.php3">
Please enter the details you wish to be inserted into the Access Database.<br>
First Name:<input name="FirstName" TYPE="text" SIZE="25"><br>
Last Name:<input name="LastName" TYPE="text" SIZE="25"><br>
Phone Number: <input name="PhoneNumber" TYPE="text" SIZE="25"><br>
<INPUT type="Submit">
</form>
";
}
function
HTML_Existing() {
echo "Existing database entries";
}
function
HTML_Foot() {
echo "</body></html>";
}
HTML_Head();
HTML_Form();
HTML_Existing();
HTML_Foot();
?>