Jump to content

spoco

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Everything posted by spoco

  1. Are you available for freelance work?
  2. There is also another way that we could accomplish this that may be easier. When a class is added, the instructor enters their name and e-mail address. Is there a way for those two fields to replace existing fields in a table? For example: The messages table has 6 messages id's 1-6 each id has a "from email" and "from name" field that is called when the message is sent. Is there a way to make it work where when an instructor enters name and e-mail it populates all of these fields before messages are sent, and when another instructor enters name and e-mail it overwrites? I will send files if someone wants to pick up a few bucks freelancing.
  3. The problem is that the way it is set up is screwy. When a class is created, the instructor enters their name and e-mail address (They want this because there may be several more instructors that may just teach one class here and there).
  4. Hi guys, I have hit a wall with a project. I think what I need to be utilizing is a Switch statement, but there may be an easier way. Basically I have a registration system where I want different tables called depending on the instructor. Here is the code that has been working with one instructor. $query_messages = sprintf("SELECT * FROM messages WHERE id=%s", "1"); $messages = mysql_query($query_messages, $databaseconn) or die(mysql_error()); $row_messages = mysql_fetch_assoc($messages); Now that the system is adding two other instructors, I need to be able to pull from tables messages2 and messages3, etc. So in theory, if: instructor=A, then the code above would run, if instructor=B, then messages would be changed to messages2, if instructor=C, then messages3 and so on. Really need help on this one.
  5. I have a form that I want the data to e-mail in a message. Everything works except for the checkbox arrays. "Array" displays when I want all values of checked boxes to display. Here is the code, I have bolded where checkbox data should be coming over. I'm not a pro so any help is greatly appreciated. $message = "<html><body>\r\n"; $message .= "<table width='500' border='0' cellpadding='2'>\r\n"; $message .= " <tr>\r\n"; $message .= " <td width='150'>School</td>\r\n"; $message .= " <td width='350'>" . $_POST['school'] . " </td>\r\n"; $message .= " </tr>\r\n"; $message .= " <tr>\r\n"; $message .= " <td width='150'>Teacher</td>\r\n"; $message .= " <td width='350'>" . $_POST['teacher'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <tr>\r\n"; $message .= " <td width='150'>Subject</td>\r\n"; $message .= " <td width='150'>" . $_POST['subject'] . "</td>\r\n"; $message .= " <td width='150'>Period</td>\r\n"; $message .= " <<td width='50'>" . $_POST['period'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Date</td>\r\n"; $message .= " <td width='50'>" . $_POST['month'] . "</td>\r\n"; $message .= " <td width='15'>" . $_POST['day'] . "</td>\r\n"; $message .= " <td width='15'>" . $_POST['year'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Time In:</td>\r\n"; $message .= " <td width='100'>" . $_POST['timeIn'] . "</td>\r\n"; $message .= " <td width='150'>Time Out:</td>\r\n"; $message .= " <td width='100'>" . $_POST['timeOut'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Teacher Location Upon Entrance</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q6_1Teacher6'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q7_comments7'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Student Engagement</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q11_2Student'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Students Engaged/Total Students</td>\r\n"; $message .= " <td width='350'>" . $_POST['q12_studentsEngagedtotal'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q15_comments15'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Teaching Alignment</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q17_3Teaching17'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q18_comments18'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Identified Learning</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q13_4Identified'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q16_comments16'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Rigor Rate</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q20_5Rigor'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q21_comments21'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Assessment Practice</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q22_6Assessment'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q27_comments27'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Instructional Practice</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q24_studentDirected'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q23_comments23'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= " <td width='150'>Learning Environment</td>\r\n"; [b]$message .= " <td width='350'>" . $_POST['q28_8Learning'] . "</td>\r\n";[/b] $message .= " </tr>\r\n"; $message .= " <td width='150'>Comments</td>\r\n"; $message .= " <td width='350'>" . $_POST['q29_comments29'] . "</td>\r\n"; $message .= " </tr>\r\n"; $message .= "</table>\r\n"; $message .= "</body></html>";
  6. The MSIS number is an ID number. It will be different for most records, basically we need an alert if a person with the same ID number is entered.
  7. I cannot get it to work. Anyone willing to take a look at the entire code? I've spent the better part of the day hung up on this.
  8. I don't have a variable, I need it to look in the database and see if the msis number exists.
  9. The field name that I want to check is called msis I have this code in there: $result = mysql_query("SELECT * WHERE msis='msis'") if (mysql_num_rows($result) != 0){ $email_to = "someone@company.com"; $email_subject = "Test E-Mail (This is the subject of the E-Mail)"; $email_body = "This is the body of the Email \nThis is a second line in the body!"; and the page will not even load.
  10. It has to do a lookup in the database to see if the ID exists somehow, right?
  11. I have a form that is sending the data to a MySQL database. I want to send an e-mail when an ID is submitted that matches an ID already in the database. For example If I submit ID 123, Name: John, the data is written to the database If I submit ID 123, Name: John again, the data is written to the database and an e-mail is sent alerting that a duplicate ID was entered. It would be setup in an IF statement, correct? This isn't right but something like: <?php if(ID=ID)){ } $email_to = "somebody@email.com"; $email_subject = "Test E-Mail (This is the subject of the E-Mail)"; $email_body = "This is the body of the Email \nThis is a second line in the body!"; ?> I would appreciate any help with this.
  12. I have 15 candidates for a position. In this vote, I want the voter to choose four candidates. I am thinking simply having checkboxes, but is there a way to require the user to check four checkboxes (i.e. kicking back an error if the voter chooses 1, 2, 3, or 5+?)
  13. Solved it by working it out thanks.
  14. User Page: <?php require_once('../Connections/MySQL.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO lessonplan (FName, LastName, school, CourseName, GradeLevel, Dates, LessonTitle, FrameworkSubject, essential, understand, Skills, realworld, pertasks, otherevidence, otherev, Activities, resources, Modifications, othermod, accelmodifications, othermodacc) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['FName'], "text"), GetSQLValueString($_POST['LastName'], "text"), GetSQLValueString($_POST['school'], "text"), GetSQLValueString($_POST['CourseName'], "text"), GetSQLValueString($_POST['GradeLevel'], "text"), GetSQLValueString($_POST['Dates'], "text"), GetSQLValueString($_POST['LessonTitle'], "text"), GetSQLValueString($_POST['FrameworkSubject'], "text"), GetSQLValueString($_POST['essential'], "text"), GetSQLValueString($_POST['understand'], "text"), GetSQLValueString($_POST['Skills'], "text"), GetSQLValueString($_POST['realworld'], "text"), GetSQLValueString($_POST['pertasks'], "text"), GetSQLValueString($_POST['otherevidence'], "text"), GetSQLValueString($_POST['otherev'], "text"), GetSQLValueString($_POST['Activities'], "text"), GetSQLValueString($_POST['resources'], "text"), GetSQLValueString($_POST['Modifications'], "text"), GetSQLValueString($_POST['othermod'], "text"), GetSQLValueString($_POST['accelmodifications'], "text"), GetSQLValueString($_POST['othermodacc'], "text")); mysql_select_db($database_MySQL, $MySQL); $Result1 = mysql_query($insertSQL, $MySQL) or die(mysql_error()); $insertGoTo = "thanks.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; include("thanks.php"); } header(sprintf("Location: %s", $insertGoTo)); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Lesson Plan Template</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <link href="form.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- body { background-color: #3b587a; } a:link { color: #000; } --> </style></head> <body> <div id="content"> <div id="colOne"> <h2>Lesson PLan template</h2> <form name="form1" id="form1" method="POST" action="<?php echo $editFormAction; ?>"> <p> <label>Teacher Name: <input type="text" name="FName" id="FName" /> </label> <label> <input type="text" name="LastName" id="LastName" /> </label> </p> <p>High School: <label> <select name="school" id="school"> <option selected="selected">Select School</option> <option value="Brandon">Brandon</option> <option value="Florence">Florence</option> <option value="McLaurin">McLaurin</option> <option value="Northwest Rankin">Northwest Rankin</option> <option value="Pelahatchie">Pelahatchie</option> <option value="Pisgah">Pisgah</option> <option value="Puckett">Puckett</option> <option value="Richland">Richland</option> </select> </label> <br /> <br /> Course Name: <label> <input name="CourseName" type="text" id="CourseName" size="50" /> </label> <br /> </p> Grade Level(s) <em>Check all that apply</em>: <table width="92"> <tr> <td><label> <input type="checkbox" name="GradeLevel" value="9" id="GradeLevel" /> 9th</label></td> </tr> <tr> <td><label> <input type="checkbox" name="GradeLevel" value="10" id="GradeLevel" /> 10th</label></td> </tr> <tr> <td><label> <input type="checkbox" name="GradeLevel" value="11" id="GradeLevel" /> 11th</label></td> </tr> <tr> <td><label> <input type="checkbox" name="GradeLevel" value="12" id="GradeLevel" /> 12th</label></td> </tr> </table> <p>Dates for Lesson/Unit: <label> <input type="text" name="Dates" id="Dates" /> </label> </p> <p>Lesson/Unit Title: <label> <input name="LessonTitle" type="text" id="LessonTitle" size="35" /> </label> </p> <h2><strong>STAGE ONE: DESIRED RESULTS</strong></h2> <p>RCSD Framework (Competency): <select name="FrameworkSubject" id="FrameworkSubject"> <option selected="selected">Select a Course</option> <option value="Business and Technology">Business and Technology</option> <option value="English and Language Arts">English and Language Arts</option> <option value="Foreign Languages">Foreign Languages</option> <option value="Mathematics">Mathematics</option> <option value="Health/PE">Health/PE</option> <option value="Science">Science</option> <option value="Social Studies">Social Studies</option> <option value="Visual and Performing Arts">Visual and Performing Arts</option> </select> <a href="frameworks.html" target="_blank">View Frameworks </a></p> <p> <textarea name="essential2" id="essential2" cols="45" rows="5"></textarea> </p> <p>Essential Questions: </p> <p> <label> <textarea name="essential" id="essential" cols="45" rows="5"></textarea> </label> </p> <p>Students Will Understand <em>(list specifics about content)</em>: </p> <p> <label> <textarea name="understand" id="understand" cols="45" rows="5"></textarea> </label> </p> <p>Students will Be Able To<em> (list skills students will perform)</em>: </p> <p> <label> <textarea name="Skills" id="Skills" cols="45" rows="5"></textarea> </label> </p> <p>Real World Appreciation <em>(how will students connect information learned to the real world)</em>: </p> <p> <label> <textarea name="realworld" id="realworld" cols="45" rows="5"></textarea> </label> </p> <h2><strong>STAGE TWO: ASSESSMENT EVIDENCE</strong></h2> <p>Performance Tasks <em>(list specific activities students will perform and include verb such as write, create, propose, plan, analyze, develop, discuss)</em>. Remember <strong>GRASPS</strong> (Goal, Role, Audience, Situation, Product/Performance/Purpose, Criteria for Success). Put DOK level at the end of each task listed.</p> <p> <textarea name="pertasks" id="pertasks" cols="45" rows="5"></textarea> </p> <p>Other Evidence:</p> <p> <label> <select name="otherevidence" id="otherevidence"> <option selected="selected">Select one</option> <option value="Quiz">Quiz</option> <option value="Homework">Homework</option> <option value="Oral or Written Response">Oral or Written Response</option> <option value="Unit Test">Unit Test</option> <option value="Use of Vocabulary in Context">Use of Vocabulary in Context</option> <option value="Rubric">Rubric</option> <option value="Graphic Display">Graphic Display With Analysis</option> <option value="Survey Data Analysis">Survey Data Analysis</option> <option value="Summary">Summary</option> <option value="Thinking Map">Thinking Map</option> <option value="Notes taken">Notes taken</option> <option value="Original Writing">Original Writing</option> <option value="Small Group Project">Small Group Project</option> <option value="Informal Observation">Informal Observation</option> <option value="Reflection (Written or Oral)">Reflection (Written or Oral)</option> <option value="Other">Other</option> </select> </label> </p> <p>If Other, please specify: <label> <input type="text" name="otherev" id="otherev" /> </label> </p> <h2>STAGE THREE: LEARNING PLAN</h2> <p>Learning Activities (List activities that students will complete.) </p> <p>Remember WHERETO <br /> <strong>W</strong>=ensure that students understand WHERE unit is headed and why<br /> <strong>H</strong>=HOOK students early and HOLD their attention<br /> <strong>E</strong> = EQUIP students with necessary experiences, tools, knowledge, know-how <br /> <strong>R</strong> = provide students with chance to RETHINK their ideas, REFLECT on <br /> progress and REVISE their work<br /> <strong>E</strong> = have students EVALUATE progress and self-assess<br /> <strong>T</strong> = TAILOR to fit individual talents, interests, needs, styles<br /> <strong>O</strong> = be ORGANIZED for deep understanding (not superficial coverage)</p> <p> <textarea name="Activities" id="Activities" cols="45" rows="5"></textarea> </p> <p>Resources Needed:</p> <p> <textarea name="resources" id="resources" cols="45" rows="5"></textarea> </p> <p>Modifications for Struggling Learners (ELL, SPED, Tier 2 and 3):</p> <p> <label> <select name="Modifications" id="Modifications"> <option selected="selected">Select an Option</option> <option value="Peer Help">Peer Help</option> <option value="Oral Testing">Oral Testing</option> <option value="Reduction # Answers">Reduction # Answers</option> <option value="Extra Help">Extra Help</option> <option value="Night Library">Night Library</option> <option value="Extended Time">Extended Time</option> <option value="Tutoring">Tutoring</option> <option value="Leveled Books">Leveled Books</option> <option value="Shorter Assignments">Shorter Assignments</option> <option value="Small Group Instruction">Small Group Instriction</option> <option value="Other">Other</option> </select> </label> </p> <p>If Other, please specify: <label> <input type="text" name="othermod" id="othermod" /> </label> </p> <p>Modifications for Accelerated Learners:</p> <p> <label> <select name="accelmodifications" id="accelmodifications"> <option selected="selected">Select an Option</option> <option value="Modification of assignment to include deeper concepts">Modification of assignment to include deeper concepts</option> <option value="Modification of assignment to include technology use">Modification of assignment to include technology use</option> <option value="Change in difficulty level of assignment">Change in difficulty level of assignment</option> <option value="Other">Other</option> </select> </label> </p> <p>If Other, please specify: <label> <input type="text" name="othermodacc" id="othermodacc" /> </label> </p> <p> <label> <input type="submit" name="Submit Form" id="Submit Form" value="Submit" /> </label> </p> <input type="hidden" name="MM_insert" value="form1" /> </form> <p> </p> </div> <div style="clear: both;"></div> </div> </body> </html> Thanks page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Northwest Rankin Online Lesson Plan Templates</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <style type="text/css"> <!-- body { background-color: #FFF; } a:link { color: #000; } --> </style></head> <body> <h1><strong>Lesson Plan Submitted</strong></h1> <p>Please save or print this page for your records.</p> <table width="893" border="0"> <tr> <td width="202">Teacher Name:</td> <td width="681"><?php echo $_POST ["FName"]; ?> <?php echo $_POST ["LastName"]; ?> </td> </tr> <tr> <td>School:</td> <td><?php echo $_POST ["school"]; ?></td> </tr> <tr> <td>Course Name:</td> <td><?php echo $_POST ["CourseName"]; ?></td> </tr> <tr> <td>Grade Level:</td> <td><?php echo $_POST ["GradeLevel"]; ?></td> </tr> <tr> <td>Dates:</td> <td><?php echo $_POST ["Dates"]; ?></td> </tr> <tr> <td>Lesson Title:</td> <td><?php echo $_POST ["LessonTitle"]; ?></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>RCSD Framework: </td> <td><?php echo $_POST ["Framework"]; ?></td> </tr> <tr> <td>Essential Questions:</td> <td><?php echo $_POST ["essential"]; ?></td> </tr> <tr> <td>Students Will Understand:</td> <td><?php echo $_POST ["understand"]; ?></td> </tr> <tr> <td>Students Will Be Able To:</td> <td><?php echo $_POST ["Skills"]; ?></td> </tr> <tr> <td>Real World Appreciation: </td> <td><?php echo $_POST ["realworld"]; ?></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Performance Tasks</td> <td><?php echo $_POST ["pertasks"]; ?></td> </tr> <tr> <td>Other Evidence</td> <td><?php echo $_POST ["otherevidence"]; ?> <?php echo $_POST ["otherev"]; ?></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Learning Activities:</td> <td><?php echo $_POST ["Activities"]; ?></td> </tr> <tr> <td>Resources Needed:</td> <td><?php echo $_POST ["resources"]; ?></td> </tr> <tr> <td>Modifications for Struggling Learners:</td> <td><?php echo $_POST ["Modifications"]; ?> <?php echo $_POST ["othermod"]; ?></td> </tr> <tr> <td>Modifications for Accellerated Learners:</td> <td><?php echo $_POST ["accelmodifications"]; ?> <?php echo $_POST ["othermodacc"]; ?></td> </tr> <tr> <td> </td> <td> </td> </tr> </table> <p> </p> </body> </html>
  15. I guess I don't get it. I added your line of code in the user page and it doesn't seem to be doing anything.
  16. why don't you just include the thankyou page after you process the form? This sounds like exactly what I need to do, however I have no idea how to do this or where to get help doing it. New to PHP and programming in general.
  17. There is no registration required for this page, so I do not believe that sessions are a possibility. How would I go about passing all of the data through a hidden field? Sorry, I am just learning PHP.
  18. Hello, I have two PHP pages that I have created. The user page contains a form that a user can fill out and submit. Once submitted, I want the data to write to a MySQL database and take the user to another page that shows what they entered (allows them to print for their records) I can do one or the other, but not both. In the working version that writes to the database, the form action is: <form name="form1" id="form1" method="POST" action="<?php echo $editFormAction; ?>"> $editFormAction is: $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO lessonplan (FName, LastName, school, CourseName, GradeLevel, Dates, LessonTitle, FrameworkSubject, essential, understand, Skills, realworld, pertasks, otherevidence, otherev, Activities, resources, Modifications, othermod, accelmodifications, othermodacc) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['FName'], "text"), GetSQLValueString($_POST['LastName'], "text"), GetSQLValueString($_POST['school'], "text"), GetSQLValueString($_POST['CourseName'], "text"), GetSQLValueString($_POST['GradeLevel'], "text"), GetSQLValueString($_POST['Dates'], "text"), GetSQLValueString($_POST['LessonTitle'], "text"), GetSQLValueString($_POST['FrameworkSubject'], "text"), GetSQLValueString($_POST['essential'], "text"), GetSQLValueString($_POST['understand'], "text"), GetSQLValueString($_POST['Skills'], "text"), GetSQLValueString($_POST['realworld'], "text"), GetSQLValueString($_POST['pertasks'], "text"), GetSQLValueString($_POST['otherevidence'], "text"), GetSQLValueString($_POST['otherev'], "text"), GetSQLValueString($_POST['Activities'], "text"), GetSQLValueString($_POST['resources'], "text"), GetSQLValueString($_POST['Modifications'], "text"), GetSQLValueString($_POST['othermod'], "text"), GetSQLValueString($_POST['accelmodifications'], "text"), GetSQLValueString($_POST['othermodacc'], "text")); mysql_select_db($database_MySQL, $MySQL); $Result1 = mysql_query($insertSQL, $MySQL) or die(mysql_error()); $insertGoTo = "thanks.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } ?> thanks.php is the page that I want the user to go to after they submit, the user goes there, but none of the data posts. If I change the form action to simply "thanks.php," the data posts to the thanks.php page but does not write to the database. thanks.php looks like this: <p>Please save or print this page for your records.</p> <table width="893" border="0"> <tr> <td width="202">Teacher Name:</td> <td width="681"><?php echo $_POST ["FName"]; ?> <?php echo $_POST ["LastName"]; ?> </td> </tr> <tr> <td>School:</td> <td><?php echo $_POST ["school"]; ?></td> </tr> <tr> <td>Course Name:</td> <td><?php echo $_POST ["CourseName"]; ?></td> </tr> <tr> <td>Grade Level:</td> <td><?php echo $_POST ["GradeLevel"]; ?></td> </tr> <tr> <td>Dates:</td> <td><?php echo $_POST ["Dates"]; ?></td> </tr> <tr> <td>Lesson Title:</td> <td><?php echo $_POST ["LessonTitle"]; ?></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>RCSD Framework: </td> <td><?php echo $_POST ["Framework"]; ?></td> </tr> <tr> <td>Essential Questions:</td> <td><?php echo $_POST ["essential"]; ?></td> </tr> <tr> <td>Students Will Understand:</td> <td><?php echo $_POST ["understand"]; ?></td> </tr> <tr> <td>Students Will Be Able To:</td> <td><?php echo $_POST ["Skills"]; ?></td> </tr> <tr> <td>Real World Appreciation: </td> <td><?php echo $_POST ["realworld"]; ?></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Performance Tasks</td> <td><?php echo $_POST ["pertasks"]; ?></td> </tr> <tr> <td>Other Evidence</td> <td><?php echo $_POST ["otherevidence"]; ?> <?php echo $_POST ["otherev"]; ?></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Learning Activities:</td> <td><?php echo $_POST ["Activities"]; ?></td> </tr> <tr> <td>Resources Needed:</td> <td><?php echo $_POST ["resources"]; ?></td> </tr> <tr> <td>Modifications for Struggling Learners:</td> <td><?php echo $_POST ["Modifications"]; ?> <?php echo $_POST ["othermod"]; ?></td> </tr> <tr> <td>Modifications for Accellerated Learners:</td> <td><?php echo $_POST ["accelmodifications"]; ?> <?php echo $_POST ["othermodacc"]; ?></td> </tr> That is not the complete code, byt the rest of it is just the other data fields. What am I doing wrong?
  19. Figured it out. I had inconsistent quotes. I've been looking at this for a couple of days.
  20. Background: I have a MySQL database in which I have built in PHP a way to search and pull back data. This is for a school wishing to inventory their classroom computers. I have five fields in which to search by: School Room Operating Syatem Projector Type Whiteboard Type If I search for any of the above fields and include School, it works fine. But if I want to search for any field in ALL schools, it pulls back nothing. In other words, I think I have written the code to require a school to be selected. I want to be able to search, for instance, for Projector Type, and pull back all classrooms that have a certain type of projector, regardless of the other fields. Here is the code in which I think the problem is. Thanks to the community in advance for your assistance. BONUS PROBLEM: I want the search to encompass six different fields when searching for operating system. I think this is simply a syntax error. If I search for a school and an operating system that appears in the field 'operatingsystem' it works, but not any of the other fields. <?php $school=$_POST['school']; $room=$_POST['room']; $operatingsystem=$_POST['operatingsystem']; $project=$_POST['projector']; $whiteboard=$_POST['whiteboard']; if($school=="ALL") { $where_school=""; $school_count="0"; } else { $where_school=" WHERE `school` = '$school'"; $school_count="1"; } if($room=="ALL") { $where_room=""; $room_count="0"; } else { if($school_count=="0") { $where_room=" WHERE `room` = '$room'"; } else { $where_room=" AND `room` = '$room'"; } $room_count="1"; } if($project=="ALL") { $where_project=""; $project_count="0"; } else { if($school_count=="0" && $room_count=="0") { $where_project=" WHERE `projector` = '$project'"; } else { $where_project=" AND `projector` = '$project'"; } $project_count="1"; } if($whiteboard=="ALL") { $where_whiteboard=""; $whiteboard_count="0"; } else { if($school_count=="0" && $room_count=="0" && $project_count=="0") { $where_whiteboard=" WHERE `whiteboard` = '$whiteboard'"; } else { $where_whiteboard=" AND `whiteboard` = '$whiteboard'"; } $whiteboard_count="1"; } if($operatingsystem=="ALL") { $where_operatingsystem=""; $operatingsystem_count="0"; } else { if($school_count=="0" && $room_count=="0" && $project_count=="0" && $whiteboard_count=="0") { $where_operatingsystem=" WHERE `operatingsystem`= '$operatingsystem' OR 'operatingsystem2'= '$operatingsystem' OR 'operatingsystem3'= '$operatingsystem' OR 'operatingsystem4'= '$operatingsystem' OR 'operatingsystem5'= '$operatingsystem' OR 'operatingsystem6' = '$operatingsystem'"; } else { $where_operatingsystem=" AND `operatingsystem`= '$operatingsystem' OR 'operatingsystem2'= '$operatingsystem' OR 'operatingsystem3'= '$operatingsystem' OR 'operatingsystem4'= '$operatingsystem' OR 'operatingsystem5'= '$operatingsystem' OR 'operatingsystem6' = '$operatingsystem'"; } $operatingsystem_count="1"; } ?>
  21. I have a drop down menu that is dynamically populated from a MySQL database. It is very possible that the field will have repeat names. (e.g. the field is favorite fruit - several users choose apple) On the back end where I am pulling the data, the drop down menu is dynamically populated, and will repeat apple as a choice if it appears more than once in the field. How do I make it where the repeats are ignored?
  22. Hello. I have created a PHP page with several recordsets that are querying a table and working fine overall. I would like to set up a way on this page to run the same query, but allow the user to select a school (a field in the table) and filter the same results by school. Here is an example of two recordsets (There are 21 in total) mysql_select_db($database_Survey, $Survey); $query_drops = "SELECT SUM(survey.drops) FROM survey "; $drops = mysql_query($query_drops, $Survey) or die(mysql_error()); $row_drops = mysql_fetch_assoc($drops); $totalRows_drops = mysql_num_rows($drops); mysql_select_db($database_Survey, $Survey); $query_Recordset2 = "SELECT SUM(survey.poweroutlets) FROM survey "; $Recordset2 = mysql_query($query_Recordset2, $Survey) or die(mysql_error()); $row_Recordset2 = mysql_fetch_assoc($Recordset2); $totalRows_Recordset2 = mysql_num_rows($Recordset2); What I would like to do is create a drop down menu with a list of schools in which the user can select and the same results would be displayed, only displayed by school.
  23. I am trying to write a PHP script that will write data to a MySQL database (obviously). However, the e-mail field is not working. (everything is NULL when data is entered). Is there something wrong in my coding? Form Page <? require_once("all_includes.php"); session_start(); check_valid_user(); $conn = new db_conn(); //get user id $id = $_SESSION['emp_sess_uid']; $count = 6; //get values for ($i=1; $i<=$count; $i++){ $name[$i] = addslashes(trim($_POST['ref_name' . $i])); $position[$i] = addslashes(trim($_POST['ref_pos' . $i])); $street[$i] = addslashes(trim($_POST['ref_street' . $i])); $city[$i] = addslashes(trim($_POST['ref_city' . $i])); $state[$i] = addslashes(trim($_POST['ref_state' . $i])); $zip[$i] = addslashes(trim($_POST['ref_zip' . $i])); $phone1_[$i] = addslashes(trim($_POST['ref_phone1_' . $i])); $phone2_[$i] = addslashes(trim($_POST['ref_phone2_' . $i])); $phone3_[$i] = addslashes(trim($_POST['ref_phone3_' . $i])); $phone[$i] = $phone1_[$i].$phone2_[$i].$phone3_[$i]; $email[$i] = addslashes(trim($_POST['ref_email' . $i])); } //do records already exist? for ($i=1; $i<=$count; $i++){ $ref_exists[$i] = $conn->record_exists_with_num('refs',$id,$i); //echo $i . ": ".$ref_exists[$i]; } //construct query //construct fail_to_reemploy queries for ($i=1; $i<=$count; $i++){ if (!$ref_exists[$i]){ $query = "insert into refs ("; $query .= "id, num, name, position, "; $query .= "street, city, state, zip, phone, email) "; $query .= "values ($id, "; $query .= $i . ", "; $query .= "'" . $name[$i] . "', "; $query .= "'" . $position[$i] . "', "; $query .= "'" . $street[$i] . "', "; $query .= "'" . $city[$i] . "', "; $query .= "'" . $state[$i] . "', "; $query .= "zip = " . $zip[$i] . ", "; $query .= "phone = " . $phone[$i] . " "; $query .= "email = " . $email[$i] . " "; $query .= " where id=$id "; } else{ $query = "update refs set "; $query .= "name = '" . $name[$i] . "', "; $query .= "position = '" . $position[$i] . "', "; $query .= "street = '" . $street[$i] . "', "; $query .= "city = '" . $city[$i] . "', "; $query .= "state = '" . $state[$i] . "', "; $query .= "zip = " . $zip[$i] . ", "; $query .= "phone = " . $phone[$i] . " "; $query .= "email = " . $email[$i] . " "; $query .= " where id=$id "; $query .= "and num=$i"; } //echo "<br>query: ".$query; //execute query $conn->query($query); } header("Location:".$page8); ?> Post Page <? require_once("all_includes.php"); session_start(); check_valid_user(); $conn = new db_conn(); //get user id $id = $_SESSION['emp_sess_uid']; $count = 6; //get values for ($i=1; $i<=$count; $i++){ $name[$i] = addslashes(trim($_POST['ref_name' . $i])); $position[$i] = addslashes(trim($_POST['ref_pos' . $i])); $street[$i] = addslashes(trim($_POST['ref_street' . $i])); $city[$i] = addslashes(trim($_POST['ref_city' . $i])); $state[$i] = addslashes(trim($_POST['ref_state' . $i])); $zip[$i] = addslashes(trim($_POST['ref_zip' . $i])); $phone1_[$i] = addslashes(trim($_POST['ref_phone1_' . $i])); $phone2_[$i] = addslashes(trim($_POST['ref_phone2_' . $i])); $phone3_[$i] = addslashes(trim($_POST['ref_phone3_' . $i])); $phone[$i] = $phone1_[$i].$phone2_[$i].$phone3_[$i]; $email[$i] = addslashes(trim($_POST['ref_email' . $i])); } //do records already exist? for ($i=1; $i<=$count; $i++){ $ref_exists[$i] = $conn->record_exists_with_num('refs',$id,$i); //echo $i . ": ".$ref_exists[$i]; } //construct query //construct fail_to_reemploy queries for ($i=1; $i<=$count; $i++){ if (!$ref_exists[$i]){ $query = "insert into refs ("; $query .= "id, num, name, position, "; $query .= "street, city, state, zip, phone, email) "; $query .= "values ($id, "; $query .= $i . ", "; $query .= "'" . $name[$i] . "', "; $query .= "'" . $position[$i] . "', "; $query .= "'" . $street[$i] . "', "; $query .= "'" . $city[$i] . "', "; $query .= "'" . $state[$i] . "', "; $query .= "zip = " . $zip[$i] . ", "; $query .= "phone = " . $phone[$i] . " "; $query .= "email = " . $email[$i] . " "; $query .= " where id=$id "; } else{ $query = "update refs set "; $query .= "name = '" . $name[$i] . "', "; $query .= "position = '" . $position[$i] . "', "; $query .= "street = '" . $street[$i] . "', "; $query .= "city = '" . $city[$i] . "', "; $query .= "state = '" . $state[$i] . "', "; $query .= "zip = " . $zip[$i] . ", "; $query .= "phone = " . $phone[$i] . " "; $query .= "email = " . $email[$i] . " "; $query .= " where id=$id "; $query .= "and num=$i"; } //echo "<br>query: ".$query; //execute query $conn->query($query); } header("Location:".$page8); ?>
  24. I am trying to write a callback table where I want to exclude certain records. Namely records that have been hired. My current work around is that I display "YES" in the hired field. Here is the entire code: <?php require_once("all_includes.php"); session_start(); check_valid_user(); $conn = new db_conn(); @include 'header.php'; // get posted values (from: endorsement search) $e = isset($_POST['e']) ? $_POST['e'] : null; $name = isset($_POST['name']) ? $_POST['name'] : null; ?> <body> <table border="2"> <form name="search_form" method="post" action=""> <tr> <td align=right>Name Search:</td> <td><input type="text" name="name" <?php if ($name != "") echo "value=".$name ?>></td> <td><input type="submit" value="search" name="search_name"></td> </tr> <tr> <td>Endorsement Search:</td> <td> <select name="e"> <?php codes($e); ?> </select> </td> <td><input type="submit" value="search" name="submit_e"></td> </tr> </form> </table> <p> <table border="1" width="100%"> <tr> <td height="24"><div align="center">Name</div></td> <td height="24"><div align="center">Application</div></td> <td height="24"><div align="center">Comments</div></td> <td height="24" colspan="7"><div align="center">Endorsements</div></td> <td height="24"><div align="center">Application Date</div></td> <td height="24"><div align="center">Expiration Date</div></td> <td height="24"><div align="center">Offered</div></td> <td height="24"><div align="center">Hired</div></td> </tr> <?php // 11.12.07 $query = "SELECT lastName, firstName, dateApplied, expiration, "; $query .= "end1, end2, end3, end4, end5, end6, end7, "; $query .= "generalInfo.id, offered, hired from "; $query .= "activation "; if ($e!='Show' && $e != ''){ $query .= "join certificationInfo on end1=".$e; $query .= " or end2=".$e." or end3=".$e." or end4=".$e; $query .= " or end5=".$e." or end6=".$e." or end7=".$e." "; } else $query .= ",certificationInfo "; $query .= "join generalInfo on firstName like '%" . $name . "%' "; $query .= "or lastName like '%" . $name . "%' "; $query .= "where generalInfo.id = certificationInfo.id "; $query .= "and generalInfo.id = activation.id "; $query .= "and activation.active = 1 "; $query .= "order by lastName "; //echo "query: ".$query."<br>"; $res = $conn->query ($query) or die ('Could not execute query: '.mysql_error()); for($i=0; $row = mysql_fetch_assoc($res); $i++){ // format "offered" and "hired" values displayed if ($row['offered'] == 0) $offered = "-"; else $offered = "YES"; if ($row['hired'] == 0) $hired = "-"; else $hired = "YES"; // format endorsement values displayed for ($i=1;$i<8; $i++){ $end = "end" . $i . ""; $end_arr[$i] = $row[$end]; if ($end_arr[$i] == 0) $end_arr[$i] = '-'; } echo "<tr> <td>".$row['lastName'].", ".$row['firstName']."</a></td> <td><a href = 'printable.php?id=".$row['id']."'>View</td> <td><a href = 'comments.php?id=".$row['id']."'>View</td> <td>".$end_arr[1]."</td> <td>".$end_arr[2]."</td> <td>".$end_arr[3]."</td> <td>".$end_arr[4]."</td> <td>".$end_arr[5]."</td> <td>".$end_arr[6]."</td> <td>".$end_arr[7]."</td> <td>".$row['dateApplied']."</td> <td>".$row['expiration']."</td> <td>".$offered."</td> <td>".$hired."</td> </tr>"; } ?> </table> </body> </html> <?php function codes($ca){ $file1 = "MDE_codes.txt"; $lines = file($file1); foreach ($lines as $line){ $line = trim($line); $items = split("\t",$line); //$line = trim($line); $s = "<option value=".$items[0]; if ($ca == $items[0]){ $s .= " selected"; } $s .= ">".$line."</option>\n"; echo $s; //fwrite($fh,$s); } //fclose($fh); } ?> Here is the code that is dealing with the hired records: if ($row['hired'] == 0) $hired = "-"; else $hired = "YES"; I want to exclude everything that is currently displaying "YES" Any help would be appreciated
  25. The table is showing up, but it is not being populated with data from the database. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <?php require_once('Connections/thinkingmaps.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_thinkingmaps, $thinkingmaps); $query_Totals = "SELECT sum(q1='y'), sum(q1='n'), sum(q1='w'), sum(q2='y'), sum(q2='n'), sum(q2='w'), sum(q3='y'), sum(q3='n'), sum(q3='w'), sum(q4='y'), sum(q4='n'), sum(q4='w'), sum(q5='y'), sum(q5='n'), sum(q5='w'), sum(q6='y'), sum(q6='n'), sum(q6='w'), sum(q7='y'), sum(q7='n'), sum(q7='w'), sum(q8='y'), sum(q8='n'), sum(q8='w'), sum(q9='y'), sum(q9='n'), sum(q9='w'), sum(q10='y'), sum(q10='n'), sum(q10='w'), sum(q11='y'), sum(q11='n'), sum(q11='w'), sum(q12='y'), sum(q12='n'), sum(q12='w'), sum(q13='y'), sum(q13='n'), sum(q13='w') FROM survey"; $Totals = mysql_query($query_Totals, $thinkingmaps) or die(mysql_error()); $row_Totals = mysql_fetch_assoc($Totals); $totalRows_Totals = mysql_num_rows($Totals); ?> <body> <p align="center">Totals for Survey</p> <table width="400" border="2" align="center" cellpadding="2" cellspacing="1"> <tr> <td> </td> <td> </td> <td>y</td> <td>n</td> <td>w</td> </tr> <tr> <td width="41" align="right" valign="baseline" nowrap="nowrap" bordercolor="#000000" bgcolor="#CCCCCC"><div align="left"><span class="style1">1.</span></div></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap" bordercolor="#000000" bgcolor="#FFFFFF"><div align="left"><span class="style1">2.</span></div></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap" bordercolor="#000000" bgcolor="#CCCCCC"><div align="left"><span class="style1">3.</span></div></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap" bordercolor="#000000" bgcolor="#FFFFFF"><div align="left"><span class="style1">4.</span></div></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap" bordercolor="#000000" bgcolor="#CCCCCC"><div align="left"><span class="style1">5.</span></div></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap" bordercolor="#000000" bgcolor="#FFFFFF"><div align="left"><span class="style1">6. </span></div></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap" bordercolor="#000000" bgcolor="#CCCCCC"><div align="left"><span class="style1">7. </span></div></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap" bordercolor="#000000" bgcolor="#FFFFFF"><div align="left"><span class="style1">8.</span></div></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap" bordercolor="#000000" bgcolor="#CCCCCC"><div align="left"><span class="style1">9.</span></div></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap" bordercolor="#000000" bgcolor="#FFFFFF"><div align="left"><span class="style1">10. </span></div></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap" bordercolor="#000000" bgcolor="#CCCCCC"><div align="left"><span class="style1">11.</span></div></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap" bordercolor="#000000" bgcolor="#FFFFFF"><div align="left"><span class="style1">12.</span></div></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align="right" valign="baseline" nowrap="nowrap" bordercolor="#000000" bgcolor="#FFFFFF"><div align="left"><span class="style1">13.</span></div></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> <p> </p> </body> </html> <?php mysql_free_result($Totals); ?>
×
×
  • 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.