Jump to content

bCourtney07

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

About bCourtney07

  • Birthday 11/05/1986

Profile Information

  • Gender
    Female

bCourtney07's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello All, I have an access database for class registration, and I can't figure out how to create drop down lists from dates of the class. I was just wondering if someone could assist with this, or know of a good tutorial or something. What I need to have done is, have one drop down box for the class name, and when a class name is selected, a second drop down box auto populates with the dates associated with the class name in the database. Here is the main form code <?php //config file contains connection to the database. require("config.php"); $today = date("m/d/Y"); $Class_Date = "SELECT Class_Date, Class_Name FROM Class_Information WHERE Class_Date >= '$today' AND Class_Name = 'ARP' "; $rs = $conn->Execute($Class_Date); ?> <form action="Register.php" method="post"> <table border="1" align="center"><tr><td>Employee Name: </td><td><input type=text name=Employee_Name></td></tr> </tr><tr><td>Extension: </td><td><input type=text name=Extension></td></tr><tr><td>Class Name:</td><td><select name=Class_Name><option value=" ">Please select class</option><option value=ARP>ARP</option><option value="Skills Day">Skills Day</option></select></td></tr> <?php while (!$rs->EOF) { ?> <tr><td>Class Dates:</td><td><select name="Class_Date"><option><?php echo $rs->Fields['Class_Date']->Value ?></option></select></td> <?php $rs->MoveNext(); ?> <?php } ?> </tr><tr><td colspan="2"><input type="submit" value="Register"></td></tr></table></form> <?php //closes all connections $rs->Close(); $conn->Close(); $rs = null; $conn = null; ?> config.php <?php $conn = new COM ("ADODB.Connection") or die("Cannot start ADO"); $connStr = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=F:\Class Registration/Class_Registration.mdb;"; $conn->open($connStr); //Open the connection to the database ?> and the register.php file is just the file that enters the info into the database. Any help or direction in this would be greatly appreciated! I have attached what the form looks like with the code above also. THanks so much! [attachment deleted by admin]
  2. I must just be completely stupid because i can't figure this out. I would greatly appreciate any help :-\
  3. Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft OLE DB Provider for ODBC Drivers Description: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Employee_ID = 'bcourtney' WHERE Date > 01/02/2008 AND Date < 08/15/2008'. in F:\InetPub\wwwroot\WellnessProgram\DisplayProgress2.php on line 10 ??? What am I doing wrong?
  4. Here is my select statement SELECT Employee_ID, Miles, Activity, Minutes, Date FROM Activity_Log WHERE Employee_ID = '{$_POST["Employee_ID"]}' I'm using a MS Access Database with an adodb dsn-less connection. <?php $conn = new COM ("ADODB.Connection") or die("Cannot start ADO"); $connStr = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=F:\Wellness Program\HR Employee Wellness Program.mdb;"; $conn->open($connStr); //Open the connection to the database ?> I want to narrow it down so it'll select information that is dated 01/02/2008 to 08/15/2008. How can I accomplish this? ???
  5. Okay i'm trying to display the date from a record within ms access. The date is supposed to read 1/12/2008 but instead it displays as 1200117600. Here is my code <?php require("displayconfig.php"); $sql = "SELECT * FROM Activity_Log WHERE Employee_ID = '{$_POST["Employee_ID"]}'"; $rs = $conn->Execute($sql); ?> <table border="1" cellpadding="5" cellspacing="5" align="center" width="50%"> <tr> <th>Employee ID</th> <th>Date</th> <th>Miles</th> <th>Activity</th> <th>Minutes</th> </tr> <?php while (!$rs->EOF) { ?> <tr> <td><?php echo $rs->Fields['Employee_ID']->Value ?></td> <td><?php echo $rs->Fields['Date']->Value ?></td> <td><?php echo $rs->Fields['Miles']->Value ?></td> <td><?php echo $rs->Fields['Activity']->Value ?></td> <td><?php echo $rs->Fields['Minutes']->Value ?><br></td> </tr> <?php $rs->MoveNext() ?> <?php } ?> </table> <?php $rs->Close(); $conn->Close(); $rs = null; $conn = null; ?> Does anybody know how i can fix this without having to change the data type in my ms access database? Thanks in advance!
  6. I just want it so...say somebody enters minutes, and the miles text box is empty, i don't want it to echo out as being empty. Or say somebody enters miles, and the minutes is empty.... ok for some reason my code is showing funky to me so here it is again <html> <title>Human Resources Employee Wellness Program</title> <body> <?php require("config.php"); //Checks to make sure no fields are blank $empties = array(); foreach($_POST as $key=>$value){ if(empty($value)){ $empties[] = $key; } } if(count($empties) > 0){ echo "Please fill in all required fields before submitting.<br/>"; echo "The following fields were emtpy:<br/>"; echo "<ul>"; foreach($empties as $empty){ echo "<li>".$empty."</li>"; } echo "</ul>"; exit; } // Query string to select employee name to display if they enter the correct employee_id $query="SELECT First_Name, Last_Name FROM Employee_Classification_Department WHERE Employee_ID = '{$_POST["Employee_ID"]}'"; //executes query $rs = $conn->execute($query); $num_columns = $rs->Fields->Count(); for ($i=0; $i < $num_columns; $i++) { $fld[$i] = $rs->Fields($i); } echo "<table align=center>"; while (!$rs->EOF) { echo "<tr><br></tr>"; echo "<tr>"; echo "<td>Thank you</td>"; for ($i=0; $i < $num_columns; $i++) { echo "<td>" . $fld[$i]->value . "</td>"; } echo "<td>for participating in the Human Resources Employee Wellness Program.</td>"; echo "</tr>"; echo "<tr><br></tr>"; echo "<tr><br></tr>"; echo "<tr>"; echo "<td colspan=8 align=center><a href=http://merlin/WellnessProgram/WellnessForm.htm>Return to Wellness Form</a></td>"; echo "</tr>"; $conn->execute("INSERT INTO Activity_Log (`Employee_ID`, `Date`, `Activity`, `Miles`) VALUES ('{$_POST['Employee_ID']}', '{$_POST['Date']}', '{$_POST['Activity']}', '{$_POST['Miles']}')"); $rs->MoveNext(); //move on to the next record } echo "</table>"; $rs->Close(); $conn->Close(); $rs = null; $conn = null; echo "<table align=center> <tr> <td>Not seeing your name? Make sure you have the correct Employee ID before you submit the form!</td> </tr> </table>"; ?> </body> </html>
  7. First of all, heres my code <html> <title>Human Resources Employee Wellness Program</title> <body> <?php require("config.php"); //Checks to make sure no fields are blank $empties = array(); foreach($_POST as $key=>$value){ if(empty($value)){ $empties[] = $key; } } if(count($empties) > 0){ echo "Please fill in all required fields before submitting.<br/>"; echo "The following fields were emtpy:<br/>"; echo "<ul>"; foreach($empties as $empty){ echo "<li>".$empty."</li>"; } echo "</ul>"; exit; } // Query string to select employee name to display if they enter the correct employee_id $query="SELECT First_Name, Last_Name FROM Employee_Classification_Department WHERE Employee_ID = '{$_POST["Employee_ID"]}'"; //executes query $rs = $conn->execute($query); $num_columns = $rs->Fields->Count(); for ($i=0; $i < $num_columns; $i++) { $fld[$i] = $rs->Fields($i); } echo "<table align=center>"; while (!$rs->EOF) { echo "<tr><br></tr>"; echo "<tr>"; echo "<td>Thank you</td>"; for ($i=0; $i < $num_columns; $i++) { echo "<td>" . $fld[$i]->value . "</td>"; } echo "<td>for participating in the Human Resources Employee Wellness Program.</td>"; echo "</tr>"; echo "<tr><br></tr>"; echo "<tr><br></tr>"; echo "<tr>"; echo "<td colspan=8 align=center><a href=http://merlin/WellnessProgram/WellnessForm.htm>Return to Wellness Form</a></td>"; echo "</tr>"; $conn->execute("INSERT INTO Activity_Log (`Employee_ID`, `Date`, `Activity`, `Miles`) VALUES ('{$_POST['Employee_ID']}', '{$_POST['Date']}', '{$_POST['Activity']}', '{$_POST['Miles']}')"); $rs->MoveNext(); //move on to the next record } echo "</table>"; $rs->Close(); $conn->Close(); $rs = null; $conn = null; echo "<table align=center> <tr> <td>Not seeing your name? Make sure you have the correct Employee ID before you submit the form!</td> </tr> </table>"; ?> </body> </html> Would it be possible to add something to that code to check to see if the user enters either miles or minutes into a text box? and not both? ??? or will i have to rewrite the code another way? I have to add another field to the form so users can enter Minutes instead of miles, but some users do miles instead of minutes...I appologize if i confuse you.
  8. With adodb, is it possible to have it return a value of 1 instead of -1? I want it to return a value of 1 if the user exists in a table. here is my code <?php require("config.php"); if($_GET['action'] == 'post') { if(empty($_POST['Employee_ID']) || empty($_POST['Date']) || empty($_POST['Activity']) || empty($_POST['Miles'])) { error("blank"); //Prints out error message if fields are blank exit; } if(!empty($_POST['Employee_ID'])) { $query="SELECT Employee_ID FROM analyzer_query WHERE Employee_ID = '{$_POST['Employee_ID']}'"; $rs = $conn->execute($query); $num_columns = $rs->RecordCount(); echo $num_columns . "<br>"; if($num_columns <= -1) { echo error ("user"); exit; } else { $conn->execute("INSERT INTO Activity_Log (`Employee_ID`, `Date`, `Activity`, `Miles`) VALUES ('{$_POST['Employee_ID']}', '{$_POST['Date']}', '{$_POST['Activity']}', '{$_POST['Miles']}')"); header("Location: success.php?action=success"); } } } function error($error) { if($error == 'blank') { echo "Please fill in all the required fields before submitting"; } if($error == 'user') { echo "Please fill in the correct Employee ID"; } } ?>
  9. Sorry, forgot to do this. <title>Wellness Program</title> <script type="text/javascript"> <!-- HIDE FROM INCOMPATIBLE BROWSERS function sendFocus() { document.forms[0].Employee_ID.focus(); } // STOP HIDING FROM INCOMPATIBLE BROWSERS --> </script> </head> <body onload="sendFocus()"> <form action="wellness.php?action=check" method="post"> <table align="center" width="75%" cellpadding="5" cellspacing="5"> <tr> <td rowspan="8"> <!-- IMAGE --> <img src="HeadToToeHealthcare.bmp" width="210" height="346"></td> </tr> <tr> <!-- TITLE ON TOP OF PAGE --> <th colspan="2">Human Resources Employee Wellness Program - Enter Mileage Form</th> </tr> <tr> <!-- Employee ID Field --> <td>Employee ID:</td> <td><input type="text" name="Employee_ID"></td> </tr> <tr> <!-- DATE Field --> <td>Date:</td> <td><input type="text" name="Date" onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;" onKeyDown="if(event.keyCode==13) event.keyCode=9;"></td> </tr> <tr> <!-- Activities --> <td>Activity:</td> <td> <select name="Activity"> <option value="Aerobics">Aerobics</option> <option value="BackpackingHicking">Backpacking/Hicking</option> <option value="Basketball">Basketball</option> <option value="BikeRiding">Bike Riding</option> <option value="Bowling">Bowling</option> <option value="DanceClasses">Dance Classes</option> <option value="ExerciseClass">Exercise Class</option> <option value="Football">Football</option> <option value="Golfing">Golfing</option> <option value="IceSkating">Ice Skating</option> <option value="MountainClimbing">Mountain Climbing</option> <option value="Other">Other</option> <option value="Racquetball">Racquetball</option> <option value="RollerBladingRollerSkating">Roller Blading/Roller Skating</option> <option value="Rowing">Rowing</option> <option value="Shuffleboard">Shuffleboard</option> <option value="Softball">Softball</option> <option value="Swimming">Swimming</option> <option value="TaiChi">Tai Chi</option> <option value="Tennis">Tennis</option> <option value="Volleyball">Volleyball</option> <option value="WalkingRunningJogging">Walking/Running/Jogging</option> <option value="Yoga">Yoga</option> </select> </td> </tr> <tr> <!-- Miles --> <td>Miles:</td> <td><input type="text" name="Miles" onKeypress="if (event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;" onKeyDown="if(event.keyCode==13) event.keyCode=9;"></td> </tr> <tr> <td colspan="2" align="center"><input type=submit value=Submit> <input type=reset value=Reset></td> </tr> </table> </form> <?php ob_start(); require("config.php"); if($_GET['action'] == 'check') { if(empty($_POST['Employee_ID']) || empty($_POST['Date']) || empty($_POST['Activity']) || empty($_POST['Miles'])) { //if everything is not filled in than prints out error message error("blank"); exit; } else { $row = $db_conn->GetRow("SELECT * FROM analyer_query WHERE Employee_ID='{$_POST['Employee_ID']}'") or die("Error in verifying Employee ID"); if($row != '') { $db_conn->Execute("INSERT INTO Activity_Log (`Employee_ID`, `Date`, `Activity`, `Miles`) VALUES ('{$_POST['Employee_ID']}', '{$_POST['Date']}', '{$_POST['Activity']}', '{$_POST['Miles']}')") or die("Error in connecting to the database"); header("Location: success.php?action=success"); } else { echo error("user"); } } } function error($error) { //if error is equal to blank if($error == 'blank') { echo "Please fill in all the required fields before submitting"; } //if error is equal to blank if($error == 'user') { echo "Please fill in the correct Employee ID"; } } ?> Well config file worked before i tried adding this verifying crap. it entered the information into the database fine until now. this is line number 88 $row = $db_conn->GetRow("SELECT * FROM analyer_query WHERE Employee_ID='{$_POST['Employee_ID']}'") or die("Error in verifying Employee ID");
  10. thanks, tried that. still getting the same errors.
  11. Yeah it's me again. here's my code <?php ob_start(); //include the header.php file require("config.php"); echo "<title>Human Resources Employee Wellness Program</title>"; //Displays form echo "<form method=post action=wellness.php?action=check> <table align=center width=75% cellpadding=5 cellspacing=5> <tr> <td>Employee ID:</td> <td><input type=text name=Employee_ID></td> </tr> <tr> <td>Date:</td> <td><input type=text name=Date></td> </tr> <tr> <td>Activity:</td> <td> <select name=Activity> <option value=Aerobics>Aerobics</option> <option value=BackpackingHicking>Backpacking/Hicking</option> <option value=Basketball>Basketball</option> </select> </td> </tr> <tr> <td>Miles:</td> <td><input type=text name=Miles></td> </tr> <tr> <td colspan=2 align=center><input type=submit value=Submit><input type=reset value=Reset></td> </tr> </table> </form>"; if($_GET['action'] == 'check') { if(empty($_POST['Employee_ID']) || empty($_POST['Date']) || empty($_POST['Activity']) || empty($_POST['Miles'])) { //if everything is not filled in than prints out error message error("blank"); exit; } else { $row = $db_conn->GetArray("SELECT * FROM analyer_query WHERE Employee_ID='{$_POST['Employee_ID']}'") or die("Error in verifying Employee ID"); if($row >= 0) { $db_conn->Execute("INSERT INTO Activity_Log (`Employee_ID`, `Date`, `Activity`, `Miles`) VALUES ('{$_POST['Employee_ID']}', '{$_POST['Date']}', '{$_POST['Activity']}', '{$_POST['Miles']}')") or die("Error in connecting to the database"); header("Location: success.php?action=success"); } else { echo error("user"); } } } function error($error) { //if error is equal to blank if($error == 'blank') { echo "Please fill in all the required fields before submitting"; } //if error is equal to blank if($error == 'user') { echo "Please fill in the correct Employee ID"; } } ?> here is the config.php file <?php $db_conn = new COM("ADODB.Connection"); $connstr = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=F:\Wellness Program\Copy of HR Employee Wellness Program.mdb;"; $db_conn->open($connstr); ?> here is the error i'm getting when it loads Notice: Undefined index: action in F:\InetPub\wwwroot\EmployeeWellnessProgram\wellness.php on line 44 here is line 44 if($_GET['action'] == 'check') here are the errors i'm getting when i try to submit the form Warning: (null)(): Invoke() failed: Exception occurred. Source: ADODB.Connection Description: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. in F:\InetPub\wwwroot\EmployeeWellnessProgram\wellness.php on line 54 Error in verifying Employee ID What i'm trying to do is verify that the Employee ID is correct and in the analyzer_query table. Can someone please help me? ???
  12. Okay so i really cannot figure this out and i need help if someone can help me. I need to have the employee id be validated (make sure it's in the login database) before the data from the form is put into the database if this makes any sense. here is the code for the form <?php require("config.php"); if($_GET['action'] == 'post') { if(empty($_POST['Employee_ID']) || empty($_POST['Date']) || empty($_POST['Activity']) || empty($_POST['Miles'])) { //if everything is not filled in than prints out error message error("blank"); exit; } else $db_conn->Execute("INSERT INTO Activity_Log (`Employee_ID`, `Date`, `Activity`, `Miles`) VALUES ('{$_POST['Employee_ID']}', '{$_POST['Date']}', '{$_POST['Activity']}', '{$_POST['Miles']}')") or die("Error in connecting to the database"); header("Location: success.php?action=success"); } function error($error) { //if error is equal to blank if($error == 'blank') { echo "Please fill in all the required fields before submitting"; } //if error is equal to blank if($error == 'user') { echo "Please fill in the correct Employee ID"; } } ?> here is the config.php file <?php $db_conn = new COM("ADODB.Connection"); $connstr = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=F:\Wellness Program\Copy of HR Employee Wellness Program.mdb;"; $db_conn->open($connstr); ?> Can someone help me? Point me in the direction of a tutorial or how to go about doing this. i've tried all of the above code's and haven't had any luck.
  13. Thanks! I'll try that then. My next question is.. how could i validate that the user exists? Here is my code so far <?php session_start(); require("config.php"); if($_GET['action'] == 'check') { if(empty($_POST['Employee_ID']) || empty($_POST['Last_Name'])) { //if everything is not filled in than prints out error message error("blank"); exit; } $sql="SELECT * FROM $analyzer_query WHERE Employee_ID='$Employee_ID' and Last_Name='$Last_Name'"; $result=$db_conn->Execute($sql); //counting table row $count=$db_conn->$result->Fields->Count(); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("Employee_ID"); header("location:WellnessForm.php"); } else { echo "Wrong Employee ID or Password"; } } function error($error) { //if error is equal to blank if($error == 'blank') { echo "Please fill in all the required fields before submitting"; } //if error is equal to blank if($error == 'user') { echo "Please fill in the correct Employee ID"; } } ?> with this in the config.php file <?php $db_conn = new COM("ADODB.Connection"); $connstr = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=F:\Wellness Program\Copy of HR Employee Wellness Program.mdb;"; $db_conn->open($connstr); ?>
  14. Would this be the correct way to do it then? session_start(); if (empty($_SESSION['Employee_ID'])) { $_SESSION['Employee_ID'] = ($_POST['Employee_ID']); }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.