Location: PHPKode > projects > EasyFest > new/createEvent.php
<?php
	include_once("include/db_connection.php");
	session_start();
	if($_SESSION["adminloggedIn"] == FALSE){
				header("Location:admin_login.php");
				exit;
	}
	include_once("config_admin.php");
checkLoggedIn("yes");
	include('header.php');
	include('left1.php');

?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<!--
Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Name       : Premium Series
Description: A three-column, fixed-width blog design.
Version    : 1.0
Released   : 20090303

-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Premium Series by Free CSS Templates</title>
<meta name="keywords" content="" />
<meta name="Premium Series" content="" />
<link href="default.css" rel="stylesheet" type="text/css" media="screen" />
    <link type="text/css" href="menu.css" rel="stylesheet" />
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="menu.js"></script>
	<script type="text/javascript" src="ajaxfunction.js"></script>
    <script language="JavaScript" src="gen_validatorv31.js" type="text/javascript"></script>

</head>


<body>
<!-- start header -->
<!-- end header -->
<div id="wrapper">
	<!-- start page -->
	<div id="page">
	  <!-- start content -->
        <div id="prtCnt" align="center">
		<div id="content" align="center">
		  <div class="post">
	    <h2 class="title">&nbsp;</h2>
	    <div class="entry">
        <?php 
  
  	include_once("config_admin.php");
  	
  	if(isset($_POST['EventName']))
	{
		$EventName = $_POST['EventName'];
		
		$query = "INSERT INTO events(`EventName`) VALUES ('$EventName')";

$result = mysql_query($query) or die("Invalid query: " . mysql_error() . "<br><br>". $query);
		echo "Event successfully added!!";
	
	
	}
?>
	      <table width="573" border="0">
      <tr>
        <td width="143" height="260" class="matter"><?php $query= "SELECT * FROM events ";	$result=@mysql_query($query) or die(" checkPass fatal error: ".mysql_error());
		
	// Check exactly one row is found:
	for($i=1;$i<=mysql_num_rows($result);$i++)
	{
	$row=mysql_fetch_array($result);
	echo $row[1]."<br>";
	}?>&nbsp;</td>
        
        <td width="229" >
        <form id="form2"   name="createEvent" method="post" action="<?php print $_SERVER["PHP_SELF"]; ?>">
   <span class="style1">Event</span>
        
          <p>
           <label for="EventName"> <input name="EventName" type="text"  size="45" maxlength="45" /></label>
          
          <p>&nbsp;</p>
          <p>
            <label for="submit"></label>
          </p>
        <div align="right"></div><p align="right"><input type="submit" name="submit" id="submit" value="Submit" />          
            </p>
        </form>
     
  
    </table>
                    </p>
				</div>
		  </div>
		</div>
        </div>
        <!-- end content -->
		<!-- start sidebars -->
		<!-- end sidebars -->
	  <div style="clear: both;">&nbsp;</div>
	</div>
	<!-- end page -->
</div>
</body>
</html>
<script language="JavaScript" type="text/javascript">
 var frmvalidator = new Validator("createEvent");
  frmvalidator.addValidation("EventName","req","Please enter Event name");
 frmvalidator.addValidation("EventName","maxlen=45","Max length for Event names is 45");
 frmvalidator.addValidation("EventName","alpha_s");
</script>
<?php
	include('footer.php');
?>
Return current item: EasyFest