Adding PHP script to a save button for a Job Posting site.
Posted: Tue Feb 07, 2012 3:21 pm
I have a question or rather yet I need help with a code snippet for a job posting
website that I am working on. I need to add a scipt to a save button that will gather
the job post id ($post_id) and submit the applicant info to the job/($post_id) so that the applicant has apply for the position.
Now I'm not a php expert more like a beginner but, here is the code to the page a need the functionality add.
would appreciate whatever help someone is will to give.
website that I am working on. I need to add a scipt to a save button that will gather
the job post id ($post_id) and submit the applicant info to the job/($post_id) so that the applicant has apply for the position.
Now I'm not a php expert more like a beginner but, here is the code to the page a need the functionality add.
Code: Select all
<?php
/*
Resume form: form_id = 2
Here you can modify the resume form.
This file is a file php mixed with PHP.
The php code is located between < ?php and ? > tags.
Anything outside these tags is HTML code and can be modified as normal HTML
The form has 3 modes possible: 'view', 'edit' and 'EDIT'
view - for displaying data, the data that is stored in these fields is displayed, instead
of the form field
edit - the form is displayed for editing the data by the users
EDIT - the form is displayed for editing the fileds by the Admin
How to display data from the individual fields?
- Each Field has a 'Template Tag' which is specified when editing the form.
Use the JB_get_template_value($template_tag, $form_id) function to get the data from the field.
For example, this will display the email of the resume:
echo JB_get_template_value('EMAIL', 2);
The resume form has 3 sections by default.
To display a section, a call to the JB_display_form() function is made. For example, to
print a section 1 section like this:
JB_display_form (2, $mode, $prams, 1, $admin);
How to make all resumes anonymous
Replace this checkbox
<input type="checkbox" value="Y" name="anon" ?php if($prams['anon']=='Y') { echo ' checked ';} ? >
With:
<input type="hidden" value="Y" name="anon" >
*/
// load the javascript for the SCW Date selector field (if one exists on the form)
if (!defined('SCW_INCLUDE')) {
?>
<script type='text/JavaScript' src='<?php echo JB_BASE_HTTP_PATH."scw/scw_js.php?lang=".$_SESSION['LANG']; ?>'></script>
<?php
define ('SCW_INCLUDE', 'Y');
}
if ($mode != 'view') { // editing mode, output the start of the <form> and hidden fields
?>
<form method="POST" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" name="form1" onsubmit=" form1.savebutton.disabled=true;" enctype="multipart/form-data">
<input type="hidden" name="mode" size="" value="<?php echo $mode; ?>">
<input type="hidden" name="resume_id" size="" value="<?php echo $prams['resume_id']; ?>">
<input type="hidden" name="user_id" size="" value="<?php echo $prams['user_id']; ?>">
<?php
}
// begin the Resume Form
?>
<?php /* NASTHON */
if ($mode == "view") {
$BTN_PRINTPRE = '<a class="iconbutton" title="' . $label['nasthon1007_button_print'] . '" href="javascript:printpreview();">' . '<span style="display:inline;"><img src="'.JB_THEME_URL. 'images/icon/printer.gif" style="vertical-align:middle;" border="0">' . ' ' . $label['nasthon1007_button_print'] . '</span></a>';
echo '<div class="printbtn" style="margin-top:10px;">' . $BTN_PRINTPRE . '</div>';
}
?>
<table border="0" cellSpacing="1" cellPadding="5" class="resume_data" >
<tr><td colspan="2" >
<?php
// checkbox for job seeker when editing the resume
if (($mode!='view') && (JB_RESUME_REQUEST_SWITCH!='NO') ) {
?>
<input type="checkbox" value="Y" name="anon" <?php if($prams['anon']=='Y') { echo ' checked ';} ?> > <?php echo $label["resume_priv_notice"]; ?>
<?php
}
?>
</td></tr>
<?php
// check for error, and display an error message is there is an error when saving
if (($error != '' ) && ($mode!='EDIT')) { ?>
<tr>
<td colspan="2"><?php echo "<span class='error_msg_label'>".$label["resume_save_error"]."</span><br> ".$error.""; ?></td>
</tr>
<?php } ?>
<tr>
<td valign="top" >
<?php
if ($mode == "EDIT") {
echo "[Section 1]";
}
// JB_display_form function will display the form from the database
JB_display_form (2, $mode, $prams, 1, $admin);
?>
</td>
<?php
// check if there are any fields in section 2
$sql = "SELECT * FROM form_fields WHERE form_id=2 AND section=2 ";
$result = JB_mysql_query ($sql);
if (mysql_num_rows($result)>0) {
// display section 2
?>
<td valign="top" rowspan="2">
<?php
if ($mode == "EDIT") {
echo "[Section 2]";
}
JB_display_form (2, $mode, $prams, 2, $admin);
?></td>
<?php } ?>
</tr>
<tr>
<td>
<?php
if ($mode == "EDIT") {
echo "[Section 3]";
}
// display section 3
JB_display_form (2, $mode, $prams, 3, $admin);
?></td>
</tr>
<?php
// save button (if in edit mode)
if ($mode=='edit') { ?>
<tr><td colspan="2" bgcolor="#ffffff">
<input type="hidden" name="save" id="save101" value="">
<input class="form_submit_button" TYPE="SUBMIT" name="savebutton" value="<?php echo $label['resume_save_button']; ?>" onClick="save101.value='1';">
</td></tr>
<?php } ?>
</table>
<?php if ($mode != 'view') { ?>
</form>
<?php } ?>
<?php /* NASTHON */
if ($mode == "view") {echo '<div class="printbtn">' . $BTN_PRINTPRE . '</div>'; }
?>