Hi,

I have been racking my brain trying to get this form to work. When I press the Submit button, nothing happens. I am trying to learn as I go so any help is appreciated. Thanks

<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="<?php echo $_SERVER['PHP_SELF']; ?>">
  Suffix :&nbsp;

  <input name="suffix" type="text" size="5" maxlength="5">
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Prefix :&nbsp;
  <input name="prefix" type="text" size="5" maxlength="5"><br>
  Last Name:&nbsp;<input name="lname" type="text" size="40" maxlength="40"><br>
  First Name:&nbsp;<input name="fname" type="text" size="30" maxlength="30"><br>
  MI:&nbsp;<input name="mi" type="text" size="2" maxlength="2"><br>
  Organization Name:&nbsp;<input name="orgname" type="text" size="40" maxlength="40"><br>

  Position / Title:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="postitle" type="text" size="40" maxlength="40"><br>
  Dept / Program:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="dptpgm" type="text" size="30" maxlength="30"><br>
  Section / Unit:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="secunit" type="text" size="30" maxlength="30"><br>
  BU ID:&nbsp;<input name="buid" type="text" size="15" maxlength="15"><br>
  Address Line 1:&nbsp;<input name="add1" type="text" size="40" maxlength="40"><br>
  Address Line 2:&nbsp;<input name="add2" type="text" size="40" maxlength="40"><br>

  Address Line 3:&nbsp;<input name="add3" type="text" size="40" maxlength="40"><br>
  City:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="city" type="text" size="20" maxlength="20"><br>
  County:&nbsp;<input name="county" type="text" size="20" maxlength="20"><br>
  State:&nbsp;&nbsp;&nbsp;<input name="state" type="text" size="4" maxlength="4"><br>
  Country:&nbsp;<input name="country" type="text" size="20" maxlength="20"><br>
  Zip:&nbsp;<input name="zip" type="text" size="9" maxlength="9"><br>

  Phone:&nbsp;<input name="phone" type="number" size="10" maxlength="10"><br>
  Fax:&nbsp;<input name="fax" type="number" size="10" maxlength="100"><br>
  e-mail:&nbsp;<input name="email" type="text" size="30" maxlength="30"><br>
  Group:&nbsp;<input name="grp" type="text" size="15" maxlength="15"><br>
  AP Report:&nbsp;<input name="aprpt" type="text" size="4" maxlength="4"><br>
  Human Subjects Training Certified:&nbsp;<input name="hsub" type="text" size="3" maxlength="3"><br>

  ListServ Only:&nbsp;<input name="lserv" type="text" size="3" maxlength="3"><br>
  Status:&nbsp;<input name="status" type="text" size="11" maxlength="11"><br>
  Comments:<br>&nbsp;
  <textarea name="comments" cols="40" rows="5"></textarea><br>
     <input name="Submit" type="Submit" value="Submit">&nbsp;<input name="Reset" type="Reset" value="Reset">

  </font></form>
	<?php

 if ($_POST[submit] == "Submit")
 {
     // Collect form data abd assign scalar variables

 $Suffix = $_POST[suffix];
 $Prefix = $_POST[prefix];
 $lname = $_POST[lname];
 $fname = $_POST[fname];
 $orgname = $_POST[orgname];
 $postitle = $_POST[postitle];
 $dptpgm = $_POST[dptpgm];
 $secunit = $_POST[secunit];
 $buid = $_POST[buid];
 $add1 = $_POST[add1]; 
 $add2 = $_POST[add2];   
 $add3 = $_POST[add3]; 
 $city = $_POST[city]; 
 $state = $_POST[state]; 
 $county = $_POST[county]; 
 $country = $_POST[country]; 
 $zip = $_POST[zip];
 $phone = $_POST[phone];  
 $fax = $_POST[fax];
 $email = $_POST[email];
 $grp = $_POST[grp];
 $aprpt = $_POST[aprpt];
 $hsub = $_POST[hsub];
 $lserv = $_POST[lserv];
 $status = $_POST[status];
 $comments = $_POST[comments];
  print "Suffix " & $suffix;
 //establish connection to data base

 $conn = odbc_connect('Driver={Microsoft Access Driver (*.mdb)};
 DBQ=c:\wamp\www\actest\test','','');

 // SQL statement

 $sql = "INSERT INTO BMCactive " .
 "(suffix,prefix,lname,fname,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', 
           '$orgname', '$postitle', '$dptpgm', '$secunit',
           '$buid', '$add1', '$add2', '$add3', '$city',
           '$country', '$state', '$country', '$zip', 
           '$phone', '$fax', '$email', '$grp', '$aprpt',
           '$hsub', '$lserv', '$status', '$comments')";

  // Execute SQL statement and store results as a recordset

  $rs = odbc_exec($conn,$sql);

  odbc_close($conn);

 }         
echo "Your record was successfully added!!";
?> </body> </html>

    your submit button is named Submit, not submit, notice, variables names are CaSe SeNsItIvE

      just for curiousities sake... why on earth are you using MS ACCESS for your DB?

        The form looks alright to me, it's the php bit that process the form that isn't firing. Change the key for the post array to an upper-case 'S' for '$_POST['submit'] as below. The array keys are all case sensitive.

        
        if($_POST['Submit']){
           .
           .
           .
        }
        
        

          Unfortunatly, I have to use ACCESS as I dont have access to any other form of DB.

          I changed the line you said to but it still does nothing.

          if ($_POST[Submit] == "Submit")

            try this:

            if ($_POST['Submit'] == "Submit")

              Are you sure it's correctly parsing the php? As in if you put

              echo "test";
              

              at the top of the page, does it come out? I copied your code with the one change me and stolzy suggested and it ran fine on my end. Maybe your saving the file as .html instead of .php?

                That was part of the problem. Now, I am still confused about something. Where would you put this file to test it on Apache? I have not ever used Apache before and finding the right place to put the file and getting the file path correct so I don't get the "Cannot find the server" error is a real issue with me. Any pointers would be appreciated.

                  how are you accessing right now to test it?

                  i'm confused as to how you'd even be this far if you aren't sure where to put the files

                    Can you give a little more information on your setup? Windows/linux, is this a shared host or a local server, are you working on the server, or do you upload your files somewhere?

                      OK, I was using IIS on Windows 2k. I have since uninstalled it and installed Apache 2.2.4 and PHP 5.2.2. This in on my own pc, not a shared server. It is like if you wanted to test these types of things at home if you had no access to a server. Have tried putting it in several folders under apache but none seem to click. I have verified that PHP is up and runnign and that Apache is on line.

                        it looks like you are using WAMP??

                        if so, you'd put the files in c:\wamp\www (can't recall if there is an html folder in there, but the prior directory should be close) and access them with http://localhost/

                          Do a windows search for 'htdocs', that is the direcotry that is called when you goto http://localhost. So any files/folders you put in here are accessible using that url (assuming everything is working).

                          make a test page to make sure you have php configured correctly.

                          //name it test.php or something with .php
                          <?
                          echo "Hello World!";
                          ?>
                          

                          then head to http://localhost/test.php and let us know if it loads alright.

                            Yes am using WAMP. Hold on I will see if that works.

                              No the form is still just sitting there. I will post what I have now:

                              <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="<?php echo $_SERVER['PHP_SELF']; ?>">
                                Suffix :&nbsp;
                                <input name="suffix" type="text" size="5" maxlength="5">
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Prefix :&nbsp;
                                <input name="prefix" type="text" size="5" maxlength="5"><br>
                                Last Name:&nbsp;<input name="lname" type="text" size="40" maxlength="40"><br>
                                First Name:&nbsp;<input name="fname" type="text" size="30" maxlength="30"><br>
                                MI:&nbsp;<input name="mi" type="text" size="2" maxlength="2"><br>
                                Organization Name:&nbsp;<input name="orgname" type="text" size="40" maxlength="40"><br>
                                Position / Title:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="postitle" type="text" size="40" maxlength="40"><br>
                                Dept / Program:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="dptpgm" type="text" size="30" maxlength="30"><br>
                                Section / Unit:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="secunit" type="text" size="30" maxlength="30"><br>
                                BU ID:&nbsp;<input name="buid" type="text" size="15" maxlength="15"><br>
                                Address Line 1:&nbsp;<input name="add1" type="text" size="40" maxlength="40"><br>
                                Address Line 2:&nbsp;<input name="add2" type="text" size="40" maxlength="40"><br>
                                Address Line 3:&nbsp;<input name="add3" type="text" size="40" maxlength="40"><br>
                                City:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="city" type="text" size="20" maxlength="20"><br>
                                County:&nbsp;<input name="county" type="text" size="20" maxlength="20"><br>
                                State:&nbsp;&nbsp;&nbsp;<input name="state" type="text" size="4" maxlength="4"><br>
                                Country:&nbsp;<input name="country" type="text" size="20" maxlength="20"><br>
                                Zip:&nbsp;<input name="zip" type="text" size="9" maxlength="9"><br>
                                Phone:&nbsp;<input name="phone" type="number" size="10" maxlength="10"><br>
                                Fax:&nbsp;<input name="fax" type="number" size="10" maxlength="100"><br>
                                e-mail:&nbsp;<input name="email" type="text" size="30" maxlength="30"><br>
                                Group:&nbsp;<input name="grp" type="text" size="15" maxlength="15"><br>
                                AP Report:&nbsp;<input name="aprpt" type="text" size="4" maxlength="4"><br>
                                Human Subjects Training Certified:&nbsp;<input name="hsub" type="text" size="3" maxlength="3"><br>
                                ListServ Only:&nbsp;<input name="lserv" type="text" size="3" maxlength="3"><br>
                                Status:&nbsp;<input name="status" type="text" size="11" maxlength="11"><br>
                                Comments:<br>&nbsp;
                                <textarea name="comments" cols="40" rows="5"></textarea><br>
                                   <input name="Submit" type="Submit" value="Submit">&nbsp;<input name="Reset" type="Reset" value="Reset">
                              
                                </font></form>
                              	<?php
                               if ($_POST['Submit'] == "Submit")
                              
                               {
                                   // Collect form data abd assign scalar variables
                              
                               $Suffix = $_POST[suffix];
                               $Prefix = $_POST[prefix];
                               $lname = $_POST[lname];
                               $fname = $_POST[fname];
                               $orgname = $_POST[orgname];
                               $postitle = $_POST[postitle];
                               $dptpgm = $_POST[dptpgm];
                               $secunit = $_POST[secunit];
                               $buid = $_POST[buid];
                               $add1 = $_POST[add1]; 
                               $add2 = $_POST[add2];   
                               $add3 = $_POST[add3]; 
                               $city = $_POST[city]; 
                               $state = $_POST[state]; 
                               $county = $_POST[county]; 
                               $country = $_POST[country]; 
                               $zip = $_POST[zip];
                               $phone = $_POST[phone];  
                               $fax = $_POST[fax];
                               $email = $_POST[email];
                               $grp = $_POST[grp];
                               $aprpt = $_POST[aprpt];
                               $hsub = $_POST[hsub];
                               $lserv = $_POST[lserv];
                               $status = $_POST[status];
                               $comments = $_POST[comments];
                                print "Suffix " & $suffix;
                               //establish connection to data base
                              
                               $conn = odbc_connect('Driver={Microsoft Access Driver (*.mdb)};
                               DBQ=c:\wamp\www\test','','');
                              
                               // SQL statement
                              
                               $sql = "INSERT INTO BMCactive " .
                               "(suffix,prefix,lname,fname,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', 
                                         '$orgname', '$postitle', '$dptpgm', '$secunit',
                                         '$buid', '$add1', '$add2', '$add3', '$city',
                                         '$country', '$state', '$country', '$zip', 
                                         '$phone', '$fax', '$email', '$grp', '$aprpt',
                                         '$hsub', '$lserv', '$status', '$comments')";
                              
                                // Execute SQL statement and store results as a recordset
                              
                                $rs = odbc_exec($conn,$sql);
                              
                                odbc_close($conn);
                              
                               }         
                              echo "Your record was successfully added!!";
                              ?> </body> </html>

                                Do the test to make sure php is parsing correctly, or add some debug messages in your script to see how far it goes and ensure the php is working.

                                echo "checking for post<br>";
                                if ($_POST['Submit'] == "Submit") {
                                echo "found submit... processing form<br>";
                                
                                 // Collect form data abd assign scalar variables
                                 $Suffix = $_POST[suffix];
                                 $Prefix = $_POST[prefix];
                                 $lname = $_POST[lname];
                                 .
                                 .
                                 .
                                 echo "assigned post vars<br>";
                                

                                Also your <input> tags should end with a slash if they don't require closing tag like textarea, but that's neither here nor there.

                                <input type=... />
                                

                                  Ok, i put in the echo's as instructed. I then ran it and got the foloowing:

                                  checking for post

                                  found submit... processing form

                                  then this error on all of the input fields:

                                  Notice: Use of undefined constant suffix - assumed 'suffix' in C:\wamp\www\form.php on line 55

                                  Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] The INSERT INTO statement contains the following unknown field name: 'suffix'. Make sure you have typed the name correctly, and try the operation again., SQL state S0022 in SQLExecDirect in C:\wamp\www\form.php on line 103
                                  Your record was successfully added!!

                                    What's at line 55 in your doc and the line prior to that?