%
##############################################################################
# Program Name : accept_resume.php
# Location : /employment/
# Author : Vandan Juvekar
# Date : 12/03/2001
# For : Accept new resume / Update old resume
# Called from : forms in self, updel_resume.php
# System Name : Online Resumes Database
##############################################################################
# Session Variable (explained later in this script)
session_start();
# For openConnection()
include("includes/common.inc");
openConnection("resume_db");
$today = date("Y/m/d");
%>
Enter your Resume
for (var i=0; i')
document.resume.positionInfo.selectedIndex = i;
}
<%
}
%>
}">
<%
# For HTML header and Javascript isValid()
include("includes/resume_header.inc");
# If form is not shown...
if ($action == "")
{
%>
<%
}
# If form submitted...
else #if (ereg("^http://" . $HTTP_HOST . $SCRIPT_NAME, $HTTP_REFERER))
{
switch($action)
{
# case 1 indicates that the above form is submitted
case 1:
# case 2 indicates that the below form is submitted
# If one selects more than 25 (or so) skills from the above form and submits,
# There would be more than 100 selection lists that have to be generated dynamically
# (for coursework experience, industry experience, last used - year and last used - month)
# When I try to generate these in a single page, the browsers simply do not show them
# (which is strange and unexpected!)
# Therefore, I am generating selection lists for 10 skills at a time,
# until all selected skills are shown.
# The session variable $_SESSION['numIter'] is the skills index counter which is used to
# show only 10 skills at a time.
case 2:
{
if ($action == 1) # The above form is submitted, I am going to show the selection lists for the first time
{
$_SESSION['numIter'] = 0; # Reset the skills index counter
}
# Since this form is different from the above one, we have to preserve the state in hidden variables
# The hidden variables skills_coursework_yrs, skills_industry_yrs and skills_last_used_date will
# be comma separated values containing all skill info, at the end.
%>
<% # Javascript to create semicolon-separated values %>
<%
break;
}
# case 3 will be executed when all applicant info along with skill info is gathered
# Based on the caller form, resume will be either inserted or updated
case 3:
{
$query = "SELECT id, email FROM resumes ORDER BY id desc";
$result = mysql_query($query) or die("SELECT query failed on resumes");
if ($row = mysql_fetch_array($result))
$count = $row["id"] + 1;
else
$count = 1;
if ($row["id"] != $resume_id)
$emailExists = ($row["email"] == $email);
while (!$emailExists && ($row = mysql_fetch_array($result)))
{
if ($row["id"] != $resume_id)
$emailExists = ($row["email"] == $email);
}
mysql_free_result($result);
if ($emailExists)
{
%>
A resume with the same email address already exists in our database.
Thank you for applying
<%
if ($upDel == "update")
{
$query = "DELETE FROM application_info WHERE resume_id = " . $resume_id;
$result = mysql_query($query) or die("
3.Unsuccessful. Please retry.
");
}
$positionVar = split("\|", $positionInfo);
$positionId = $positionVar[0];
if ($positionId)
{
$query = "INSERT INTO application_info VALUES ($resume_id, $positionId)";
$result = mysql_query($query);
if (mysql_affected_rows())
{
%>
for the position of <%= stripslashes($positionVar[1]) %>
<%
}
}
%>
!
Go to
MKSI home
<%
}
break;
}
} #switch ends
}
mysql_close($link);
%>