Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="https://www.w3.org/1999/xhtml">
- <head>
- <title>Contact Me</title>
- <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
- </head>
- <body>
- <h1>Interview Form</h1>
- <?php
- $ShowForm=FALSE;
- $fields = array('InterviewerName', 'InterviewerPosition', 'InterviewDate', 'CandName', 'CandCommAbilities', 'CandAppearance', 'CandCompSkills', 'CandBusinessKnowledge', 'InterviewerComments');
- $report=array();
- foreach ($fields as $field)
- $report[$field]="";
- if (isset($_POST['submit'])) {
- foreach ($fields as $field) {
- if ((!isset($_POST[$field])) || (strlen(trim(($POST[$field])))==0)) {
- echo "<p>'$field' is a required field.</p>\n";
- $ShowForm=TRUE;
- }
- else{
- $report[$field]=stripslashes(trim($_POST[$field]));
- }
- }
- if($ShowForm===FALSE) {
- $DBConnect = @mysql_connect("host", "user", "password");
- if ($DBConnect === False)
- echo "<p>Unable to connect to the database server.</p>\n"
- . "<p>Error code " . mysql_errno()
- . ": " . mysql_error() . "</p>\n";
- else {
- $DBName = "interviews";
- if (!@mysql_select_db($DBName, $DBConnect))
- echo "<p>Unable to connect to the $DBName database!</p>";
- else {
- $TableName = "interviews";
- $fieldstr="";
- $valuestr="";
- $connector="";
- foreach ($fields as $field) {
- $fieldstr .= $connector . $field;
- $valuestr .= $connector . "'" . $report[$field] . "'";
- $connector=", ";
- }
- $SQLString ="INSERT INTO $TableName (" . $fieldstr . ") VALUES ($valuestr)";
- $QueryResult = @mysql_query($SQLString, $DBConnect);
- if ($QueryResult === FALSE)
- echo "<p>There was an error saving the record.<br />\n" .
- "The error was " .
- htmlentities(mysql_error($DBConnect)) .
- ".<br />\nThe query was '" .
- htmlentities($SQLString) .
- "'</p>\n";
- else {
- echo "<p>The interview information was saved.</p>\n";
- }
- }
- }
- }
- }
- else {
- $ShowForm = TRUE;
- }
- if($ShowForm === TRUE) {
- ?>
- <form action='InterviewerForm.php' method='POST'>
- <table>
- <tr><td align='right'>Interviewer Name</td><td align='left'>
- <input type='text' size='25' name='Interviewer Name' value='<?php echo $report['InterviewerName']; ?>' />
- </td></tr>
- <tr><td align='right'>Interviewer Position</td><td align='left'>
- <input type='text' size='10' name='Interviewer Position' value='<?php echo $report['InterviewerPosition']; ?>' />
- </td></tr>
- <tr><td align='right'>Interview Date</td><td align='left'>
- <input type='text' size='10' name='Interview Date' value='<?php echo $report['InterviewDate']; ?>' />
- </td></tr>
- <tr><td align='right'>Candidate Name</td><td align='left'>
- <input type='text' size='25' name='Candidate Name' value='<?php echo $report['CandName']; ?>' />
- </td></tr>
- <tr><td align='right'>Candidate Communication Abilites</td><td align='left'>
- <input type='text' size='20' name='Candidate Communication Abilities' value='<?php echo $report['CandCommAbilities']; ?>' />
- </td></tr>
- <tr><td align='right'>Candidate Appearance</td><td align='left'>
- <input type='text' size='20' name='Candidate Appearance' value='<?php echo $report['CandAppearance']; ?>' />
- </td></tr>
- <tr><td align='right'>Candidate Computer Skills</td><td align='left'>
- <input type='text' size='20' name='Candidate Computer Skills' value='<?php echo $report['CandCompSkills']; ?>' />
- </td></tr>
- <tr><td align='right'>Candidate Business Knowledge</td><td align='left'>
- <input type='text' size='20' name='Candidate Business Knowledge' value='<?php echo $report['CandBusinessKnowledge']; ?>' />
- </td></tr>
- <tr><td align='right'>Interviewer Comments</td><td align='left'>
- <textarea cols='80' rows='6' name='Interviewer Comments'><?php echo $report['InterviewerComments']; ?></textarea>
- </td></tr>
- <tr><td align='center' colspan='2'>
- <input type='reset' name='reset' value='Clear Form' />
- <input type='submit' name='submit' value='Save Report' />
- </td></tr>
- </table>
- <?php
- }
- ?>
- <a href="ViewInterviewReports.php">View Interview Reports</a>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment