
<?php
session_start();
include('includes/class.user.php');
$user = new User(); 
include('includes/class.helper.php');
$helper = new Helper(); 
?>
<?php
 $maintitle="Charity";
$page="register.php";
$table="tbl_charity";
$field_id="charityid";
$mode=$_REQUEST['mode'];
$content_id=$_REQUEST['contentid'];
if(isset($_REQUEST['submit'])=="submit"){ 
$dataexist=array();
$required = array("firstname","lastname","email","phone","charityname","charityaddress","outline");
$values = $_POST;
unset($values['submit']);
unset($values['mode']);
//$userid=array("user_id"=>$user_id);
//$values=array_merge($values,$userid

if($_REQUEST['mode']=="add"){
$message=$helper->insert($table,$values,$required,$dataexist);

}
/*if($_REQUEST['mode']=="edit"){
$message=$helper->update($table, $values,array($field_id=>$_REQUEST['contentid']),$required);
}*/

}
?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Al Maktoum Foundation | Log in</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
  <!-- iCheck -->
  <link rel="stylesheet" href="plugins/iCheck/square/blue.css">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
  <style type="text/css">
    .form-horizontal .control-label {
    float:left!important;
    text-align: left !important;
}
.col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9{
    float:left!important;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6{
    float:left;
    text-align: left;
}
 
  </style>
</head>
<body class="hold-transition login-page" style="direction:ltr;">
     <!-- Main content -->
    <section class="content">
    
     <div class="row">

<?php

$contentdetails=$helper->select($table,"*",array($field_id=>1));

?>

     
        <!-- /.col -->
        <div class="col-md-3"></div>
        <div class="col-md-6">          
          <div class="col-md-12">
          <!-- Horizontal Form -->
          <div class="box box-info">
            <div class="box-header with-border">
              <h3 class="box-title">Charity Request Form</h3>
            </div>
            <!-- /.box-header -->
             <?php
             if($message['message']!=""){
             ?>
            <button class="btn btn-block btn-success btn-flat" type="button"><?php echo $message['message'];?></button>
            <?php
            }
            ?>
             
            <p class="login-box-msg"><img src="images/logo.png" width="150px"/></p>
            
            <!-- form start -->
            <form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
              <div class="box-body">
                  <div class="form-group">
                      <div class="col-sm-12">
                          <p> Al Maktoum Foundation is happy to consider requests for signed merchandise for registered charities, however due to the overwhelming demand we regret that it is not possible for the foundation to meet all these requests.
            </p>
                      </div>
                  </div>
                   <div class="box box-info">
                  <div class="box-header with-border">
                 <h3 class="box-title">Your Details</h3>
                  </div></div>
                <div class="form-group">
                     <input type="hidden" name="mode" value="add"/>
                  <label for="inputEmail3" class="col-sm-3 control-label">First Name</label>

                  <div class="col-sm-8">
                    <input type="text" required value="<?php echo $values['firstname'];?>" class="form-control" id="sitename" name="firstname" placeholder="First Name">
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Last Name</label>

                  <div class="col-sm-8">
   <input type="text" class="form-control" value="<?php echo $values['lastname'];?>" id="lastname" name="lastname" placeholder="Last Name" required>
                  </div>
                </div>
                
                <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Email Address</label>

                  <div class="col-sm-8">
                    <input type="email" required class="form-control" value="<?php echo $values['email'];?>"  id="email" name="email" placeholder="Email Address">
                  </div>
                </div>
                   <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Phone</label>

                  <div class="col-sm-8">
                    <input type="text" class="form-control" value="<?php echo $values['phone'];?>" id="phone" name="phone" placeholder="Phone" required>
                  </div>
                </div>
                  <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Fax</label>

                  <div class="col-sm-8">
                    <input type="text" class="form-control" value="<?php echo $values['fax'];?>" id="fax" name="fax" placeholder="Fax">
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Address</label>

                  <div class="col-sm-8">
                    <textarea class="form-control" id="address" name="address" placeholder="Address" required><?php echo $values['address'];?></textarea>
                  </div>
                </div>
                              
                <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">City</label>

                  <div class="col-sm-8">
                    <input type="text" class="form-control" id="Currency" value="<?php echo $values['city'];?>" name="city" placeholder="City" required>
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Country</label>

                  <div class="col-sm-8">
                      <?php
                  $countries= $helper->select("tbl_country","countryid,country",array());				   
				  ?>
                  <select name="country" class="form-control" id="country" required>
                  <?php
				  foreach($countries as $country){
				  ?>
                  <option <?php if($values['country']==$country['countryid']){ echo "selected";}?> value="<?php echo $country['countryid'];?>"><?php echo $country['country'];?></option>
                  <?php
				  }
				  ?>
                  </select>
                  </div>
                </div>
                  <div class="box box-info">
                  <div class="box-header with-border">
                 <h3 class="box-title">Your Charity / Event</h3>
                  </div></div>
                <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Charity Name</label>

                  <div class="col-sm-8">
                    <input type="text" name="charityname" class="form-control" id="charityname" value="<?php echo $values['charityname'];?>"  placeholder="Charity Name">
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Charity Address</label>

                  <div class="col-sm-8">
                    <textarea class="form-control" id="charityaddress" name="charityaddress" placeholder="Charity Address"><?php echo $values['charityaddress'];?></textarea>
                 
                  </div>
                </div>
               <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Please give a brief outline of your charitable objectives</label>

                  <div class="col-sm-8">
                    <textarea class="form-control" id="outline" name="outline" placeholder="Charitable Objectives"><?php echo $values['outline'];?></textarea>
                    </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Location</label>

                  <div class="col-sm-8">
                    <input type="text" name="location" class="form-control" id="location" value="<?php echo $values['location'];?>"  placeholder="Location">
                  </div>
                </div>
                <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Number of Participants</label>
                  <div class="col-sm-8">
                    <input type="text" name="participants" class="form-control" id="participants" value="<?php echo $values['participants'];?>"  placeholder="No: of Participants">
                  </div>
                </div>
                 <div class="form-group">
                  <label for="inputEmail3" class="col-sm-3 control-label">Date of Events</label>
                  <div class="col-sm-8">
                    <input type="text" name="eventdate" class="form-control" id="eventdate" value="<?php echo $values['eventdate'];?>"  placeholder="Date of Events">
                  </div>
                </div>
                
              </div>
              <!-- /.box-body -->
              <div class="box-footer">
                <button type="reset" class="btn btn-default">Cancel</button>
                <input type="submit" name="submit" value="Submit" class="btn btn-info pull-right"/>
              </div>
              <!-- /.box-footer -->
            </form>
          </div>
          <!-- /.box -->
           
        </div>
        </div>
        </div>
         

    </section>

<!-- jQuery 2.2.3 -->
<script src="plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- iCheck -->
<script src="plugins/iCheck/icheck.min.js"></script>
<script>
  $(function () {
    $('input').iCheck({
      checkboxClass: 'icheckbox_square-blue',
      radioClass: 'iradio_square-blue',
      increaseArea: '20%' // optional
    });
  });
</script>
</body>
</html>
