PHP Classes

File: createEvent.php

Recommend this page to a friend!
  Classes of ganesh kavhar   PHP Event Planner   createEvent.php   Download  
File: createEvent.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Event Planner
Application to help users to organize events
Author: By
Last change:
Date: 2 years ago
Size: 825 bytes
 

Contents

Class file image Download
<?php
require_once 'classes/Event.php';
require_once
'classes/EventTableGateway.php';
require_once
'classes/Connection.php';
require_once
'validateEvents.php';

$formdata = array();
$errors = array();

validateEvents(INPUT_POST, $formdata, $errors);

if (empty(
$errors)) {
   
$title = $formdata['Title'];
   
$description = $formdata['Description'];
   
$sDate = $formdata['StartDate'];
   
$eDate = $formdata['EndDate'];
   
$cost = $formdata['Cost'];
   
$locID = $formdata['LocID'];

   
$event = new Event(-1, $title, $description, $sDate, $eDate, $cost, $locID);

   
$connection = Connection::getInstance();

   
$gateway = new EventTableGateway($connection);

   
$id = $gateway->insert($event);

   
header('Location: viewEvents.php');
}
else {
    require
'createEventForm.php';
}