Server IP : 68.65.122.142  /  Your IP : 3.21.93.29
Web Server : LiteSpeed
System : Linux server167.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User : glenirhm ( 1318)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/glenirhm/mygc.glenbowcollege.ca/admin/attachments/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/glenirhm/mygc.glenbowcollege.ca/admin/attachments/../submit_financial_information.php
<?php
// We need to use sessions, so you should always start sessions using the below code.
session_start();

// If the user is not logged in redirect to the login page...
if (!isset($_SESSION['loggedin'])) {
	header('Location: index.html');
	exit;
}

include('../common/header_admin.php');

// Connect to the database
include('../common/connect.php');
include('../common/connectPDO.php');
include('../common/send_email.php');

// From PHPMailer code
require '../../composer/vendor/autoload.php';

use Formr\Formr;
//require_once '../Formr/class.formr.php';
$form = new Formr('bootstrap');

// only allow images to be uploaded
$form->upload_accepted_mimes = 'images';

// define our upload directory
$form->upload_dir = 'uploads';

// rename our upload with a 32-character hash
$form->upload_rename = 'hash';

//$form->required = '*';
if (isset($_GET["id"])) {
    $id = $_GET["id"];
    $_SESSION["id"] = $id;
}
else {
    $id = $_SESSION["id"]; 
}

$sql = "SELECT * FROM student WHERE id=$id";
$stmt = $pdo->query($sql);
while ($row = $stmt->fetch())
{
    echo 'First Name: ' . $row['fname'] . '<br>'.
    'Last Name: ' . $row['lname'] . '<br>'.
    'Email: ' . $row['email'] . '<br><br><br>';
}

if($form->submit()) {
    $registration_fee = $form->post('registration_fee');
    $book_fee = $form->post('book_fee');
    $tuition_fee = $form->post('tuition_fee');
    $student_aid_grant = $form->post('student_aid_grant');
    $student_aid_loan = $form->post('student_aid_loan');
    $self_financed = $form->post('self_financed');
    $agreed_total_fee = $form->post('agreed_total_fee');
    $scholarship = $form->post('scholarship');
    $financial_notes = $form->post('financial_notes');

    if(!$form->errors()) {

      $sql2 = "UPDATE student SET 
      registration_fee = '$registration_fee', 
      book_fee = '$book_fee',
      tuition_fee = '$tuition_fee',
      student_aid_grant = '$student_aid_grant',
      student_aid_loan = '$student_aid_loan',
      self_financed = '$self_financed',
      agreed_total_fee = '$agreed_total_fee',
      scholarship = '$scholarship',
      financial_notes = '$financial_notes'
      WHERE id = '$id'";

      //echo $sql2;
      if($con->query($sql2) === true){
          //echo "Records inserted successfully.";
          $form->success_message('Financial information has just been entered.');
      } else{
          echo "ERROR: Could not able to execute $sql2. " . $con->error;
      }
      
      // Close connection
      $con->close();
    }
}

?>

<div class="container">
  <?php
    // always print Formr's messages!
    $form->messages();

    // open our form element
    $form->open_multipart();

    // define our upload directory
    $form->upload_dir = 'uploads';

    // rename our upload with a 32-character hash
    $form->upload_rename = 'hash';

    $form->number('registration_fee', 'Registration fee');
    $form->number('book_fee', 'Book fee');
    $form->number('tuition_fee', 'Tuition fee');
    $form->number('student_aid_grant', 'Student aid (grant)');
    $form->number('student_aid_loan', 'Student aid (loan)');
    $form->input_select('self_financed', 'Self financed?','','','','','',['Yes', 'No', 'Partial']);
    $form->number('agreed_total_fee', 'Agreed total fee');
    $form->number('scholarship', 'Scholarship');
    $form->text('financial_notes', 'Financial comments');
    
    $form->input_submit();
    
    $form->form_close();
    

  ?>
</div>