Ok, I am really new to PHP and need help. I have attempted to write what I thought would take data from an HTML form on a PHP page and add it to an Access database.
I am not sure if what I have is correct or not. I may have mixed ASP and PHP together somehow. Could someone kindly take a look at the code below and tell me what I am doing wrong?
Form Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Administrator / Private Investigator Sign Up</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body >
<p align="left"><img src="file:///C|/Documents%20and%20Settings/aurobins/Desktop/logo_extranet.gif" width="156" height="67">
<font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#0000FF"><br><br><br>
<strong>Use this form if you are signing up as a new Administrator
or Private Investigator </strong></p><br><br>
<form method="POST" action="noname3.php">
Suffix :
<input name="suffix" type="text" size="5" maxlength="5">
Prefix :
<input name="prefix" type="text" size="5" maxlength="5"><br>
Last Name: <input name="lname" type="text" size="40" maxlength="40"><br>
First Name: <input name="fname" type="text" size="30" maxlength="30"><br>
MI: <input name="mi" type="text" size="2" maxlength="2"><br>
Organization Name: <input name="orgname" type="text" size="40" maxlength="40"><br>
Position / Title: <input name="postitle" type="text" size="40" maxlength="40"><br>
Dept / Program: <input name="dptpgm" type="text" size="30" maxlength="30"><br>
Section / Unit: <input name="secunit" type="text" size="30" maxlength="30"><br>
BU ID: <input name="buid" type="text" size="15" maxlength="15"><br>
Address Line 1: <input name="add1" type="text" size="40" maxlength="40"><br>
Address Line 2: <input name="add2" type="text" size="40" maxlength="40"><br>
Address Line 3: <input name="add3" type="text" size="40" maxlength="40"><br>
City: <input name="city" type="text" size="20" maxlength="20"><br>
County: <input name="county" type="text" size="20" maxlength="20"><br>
State: <input name="state" type="text" size="4" maxlength="4"><br>
Country: <input name="country" type="text" size="20" maxlength="20"><br>
Zip: <input name="zip" type="text" size="9" maxlength="9"><br>
Phone: <input name="phone" type="number" size="10" maxlength="10"><br>
Fax: <input name="fax" type="number" size="10" maxlength="100"><br>
e-mail: <input name="email" type="text" size="30" maxlength="30"><br>
Group: <input name="grp" type="text" size="15" maxlength="15"><br>
AP Report: <input name="aprpt" type="text" size="4" maxlength="4"><br>
Human Subjects Training Certified: <input name="hsub" type="text" size="3" maxlength="3"><br>
ListServ Only: <input name="lserv" type="text" size="3" maxlength="3"><br>
Status: <input name="status" type="text" size="11" maxlength="11"><br>
Comments:<br>
<textarea name="comments" cols="40" rows="5"></textarea>
</font></form>
<input name="Submit" type="submit" value="Submit"> <input name="Reset" type="Reset" value="Reset">
</body>
</html>
Connection code:
<?php
$db = 'C:\\Documents and Settings\aurobins\Desktop\db1.mdb
if(!$db)
die("no db");
?>
Write to MS Access table code:
<?php
include "connect.php";
$conn = new COM('ADODB.Connection');
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db);
if(isset($_POST['submit']))
{
$insert="Insert into BMCactive"
(suffix,prefix,lname,fname,mi,orgname,postitle,dptpgm,secunit,
buid,add1,add2,add3,city,county,state,country,zip,phone,fax,
email,grp,aprpt,hsub,lserv,status,comments)
values('$suffix','$prefix','$lname','$fname','$mi','$orgname',
'$postitle','$dptpgm','$secunit','$buid','$add1','$add2',
'$add3','$city','$county','$state','$country','$zip',
'$phone','$fax','$email','$grp','$aprpt','$hsub','$lserv',
'$status','$comments');
$rs = $conn->Execute($sql);
echo "Your record was entered successfully!!";
?>
Thanks in advance for any help provided.