Guest User

InterviewerForm

a guest
Apr 12th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.37 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="https://www.w3.org/1999/xhtml">
  4. <head>
  5. <title>Contact Me</title>
  6. <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
  7. </head>
  8. <body>
  9. <h1>Interview Form</h1>
  10. <?php
  11. $ShowForm=FALSE;
  12. $fields = array('InterviewerName', 'InterviewerPosition', 'InterviewDate', 'CandName', 'CandCommAbilities', 'CandAppearance', 'CandCompSkills', 'CandBusinessKnowledge', 'InterviewerComments');
  13. $report=array();
  14. foreach ($fields as $field)
  15.     $report[$field]="";
  16. if (isset($_POST['submit'])) {
  17.   foreach ($fields as $field) {
  18.     if ((!isset($_POST[$field])) || (strlen(trim(($POST[$field])))==0)) {
  19.       echo "<p>'$field' is a required field.</p>\n";
  20.       $ShowForm=TRUE;
  21.     }
  22.     else{
  23.       $report[$field]=stripslashes(trim($_POST[$field]));
  24.     }
  25.   }
  26.   if($ShowForm===FALSE) {
  27.     $DBConnect = @mysql_connect("host", "user", "password");
  28.     if ($DBConnect === False)
  29.       echo "<p>Unable to connect to the database server.</p>\n"
  30.         . "<p>Error code " . mysql_errno()
  31.         . ": " . mysql_error() . "</p>\n";
  32.     else {
  33.       $DBName = "interviews";
  34.       if (!@mysql_select_db($DBName, $DBConnect))
  35.         echo "<p>Unable to connect to the $DBName database!</p>";
  36.       else {
  37.         $TableName = "interviews";
  38.         $fieldstr="";
  39.         $valuestr="";
  40.         $connector="";
  41.         foreach ($fields as $field) {
  42.              $fieldstr .= $connector . $field;
  43.              $valuestr .= $connector . "'" . $report[$field] . "'";
  44.              $connector=", ";
  45.       }
  46.       $SQLString ="INSERT INTO $TableName (" . $fieldstr . ") VALUES ($valuestr)";
  47.       $QueryResult = @mysql_query($SQLString, $DBConnect);
  48.       if ($QueryResult === FALSE)
  49.            echo "<p>There was an error saving the record.<br />\n" .
  50.                 "The error was " .
  51.                 htmlentities(mysql_error($DBConnect)) .
  52.                 ".<br />\nThe query was '" .
  53.                 htmlentities($SQLString) .
  54.                 "'</p>\n";
  55.       else {
  56.            echo "<p>The interview information was saved.</p>\n";
  57.       }
  58.     }
  59.   }
  60. }
  61. }
  62. else {
  63.   $ShowForm = TRUE;
  64. }
  65. if($ShowForm === TRUE) {
  66. ?>
  67. <form action='InterviewerForm.php' method='POST'>
  68. <table>
  69. <tr><td align='right'>Interviewer Name</td><td align='left'>
  70.       <input type='text' size='25' name='Interviewer Name' value='<?php echo $report['InterviewerName']; ?>' />
  71.       </td></tr>
  72. <tr><td align='right'>Interviewer Position</td><td align='left'>
  73.       <input type='text' size='10' name='Interviewer Position' value='<?php echo $report['InterviewerPosition']; ?>' />
  74.       </td></tr>
  75. <tr><td align='right'>Interview Date</td><td align='left'>
  76.       <input type='text' size='10' name='Interview Date' value='<?php echo $report['InterviewDate']; ?>' />
  77.       </td></tr>
  78. <tr><td align='right'>Candidate Name</td><td align='left'>
  79.       <input type='text' size='25' name='Candidate Name' value='<?php echo $report['CandName']; ?>' />
  80.       </td></tr>
  81. <tr><td align='right'>Candidate Communication Abilites</td><td align='left'>
  82.       <input type='text' size='20' name='Candidate Communication Abilities' value='<?php echo $report['CandCommAbilities']; ?>' />
  83.       </td></tr>
  84. <tr><td align='right'>Candidate Appearance</td><td align='left'>
  85.       <input type='text' size='20' name='Candidate Appearance' value='<?php echo $report['CandAppearance']; ?>' />
  86.       </td></tr>
  87. <tr><td align='right'>Candidate Computer Skills</td><td align='left'>
  88.       <input type='text' size='20' name='Candidate Computer Skills' value='<?php echo $report['CandCompSkills']; ?>' />
  89.       </td></tr>
  90. <tr><td align='right'>Candidate Business Knowledge</td><td align='left'>
  91.       <input type='text' size='20' name='Candidate Business Knowledge' value='<?php echo $report['CandBusinessKnowledge']; ?>' />
  92.       </td></tr>
  93. <tr><td align='right'>Interviewer Comments</td><td align='left'>
  94.       <textarea cols='80' rows='6' name='Interviewer Comments'><?php echo $report['InterviewerComments']; ?></textarea>
  95.       </td></tr>
  96. <tr><td align='center' colspan='2'>
  97.       <input type='reset' name='reset' value='Clear Form' /> &nbsp;
  98.       <input type='submit' name='submit' value='Save Report' />
  99.       </td></tr>
  100. </table>
  101. <?php
  102. }
  103. ?>
  104. <a href="ViewInterviewReports.php">View Interview Reports</a>
  105. </body>
  106. </html>
Advertisement
Add Comment
Please, Sign In to add comment