Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php require_once('Connections/connection.php'); ?>
- <?php
- echo"
- <!DOCTYPE html>
- <html>
- <head>
- <title>Sistem Pengurusan Pendaftaran Peserta Olahraga Rumah Sukan Zubair </title>
- </head>
- <body bgcolor='#FF4646'>
- <table align='center'width='50%''>
- <tr>
- <td><img src='izzham.jpg'</td>
- </tr>
- <tr>
- <td bgcolor='#00FF00' align='left'>";include('masa.php');echo"</td>
- </tr>
- <tr height='180'valign = 'top' align='center'>
- <td>
- ";
- ?>
- <?php
- function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
- {
- $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
- switch ($theType) {
- case "text":
- $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
- break;
- case "long":
- case "bigint":
- $theValue = ($theValue != "") ? intval($theValue) : "NULL";
- break;
- case "double":
- $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
- break;
- case "date":
- $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
- break;
- case "defined":
- $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
- break;
- }
- return $theValue;
- }
- mysql_select_db($database_connection, $connection);
- $query_rsKelas="SELECT idkelas,namakelas FROM kelas";
- $rsKelas = mysql_query($query_rsKelas) or die(mysql_error());
- $row_rsKelas= mysql_fetch_assoc($rsKelas);
- $totalRows_rsKelas= mysql_num_rows($rsKelas);
- $editFormAction = $_SERVER['PHP_SELF'];
- if (isset($_SERVER['QUERY_STRING'])) {
- $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
- }
- if ((isset($_POST["btnSubmit"])) && ($_POST["btnSubmit"] == "Insert record")) {
- $insertSQL = sprintf("INSERT INTO peserta ( nama, nokp, kelas, jantina) VALUES (%s, %s, %s, %s)",
- GetSQLValueString($_POST['namapeserta'], "text"),
- GetSQLValueString($_POST['nokp'], "bigint"),
- GetSQLValueString($_POST['namakelas'], "text"),
- GetSQLValueString($_POST['jantina'], "text"));
- mysql_select_db($database_connection, $connection);
- $Result1 = mysql_query($insertSQL,$connection ) or die(mysql_error());
- $insertGoTo = "paparpeserta.php";
- if (isset($_SERVER['QUERY_STRING'])) {
- $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
- echo "<script>alert('Record is inserted successfully.')</script>";
- $insertGoTo .= $_SERVER['QUERY_STRING'];
- }
- header(sprintf("Location: %s", $insertGoTo));
- }
- ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <title>Untitled Document</title>
- <style type="text/css">
- <!--
- .style1 {
- font-size: 24px;
- color: #000000;
- }
- .style2 {color: #00FF66}
- -->
- </style>
- </head>
- <body>
- <form method="post" name="form2" action="<?php echo $editFormAction; ?>">
- <p> </p>
- <p align="center" class="style1">DAFTAR PESERTA </p>
- <table align="center" bordercolor="#000000" bgcolor="#CCCCFF">
- <tr valign="baseline">
- <td nowrap align="right">Nama:</td>
- <td><input type="text" name="namapeserta" value="" size="32"></td>
- </tr>
- <tr valign="baseline">
- <td nowrap align="right">No.KP:</td>
- <td><input type="text" name="nokp" value="" size="32"></td>
- </tr>
- <tr valign="baseline">
- <td nowrap align="right">Jantina:</td>
- <td><select name="jantina">
- <option value="">Sila Pilih</option>
- <option value="L">Lelaki</option>
- <option value="P">Perempuan</option></select></td>
- </tr>
- <tr valign="baseline">
- <td nowrap align="right">Kelas :</td>
- <td><select name="namakelas" id="idkelas">
- <option value="">Sila Pilih</option>
- <?php
- do {
- ?>
- <option value="<?php echo $row_rsKelas['idkelas']?>"><?php echo ($row_rsKelas['idkelas'])?></option>
- <?php
- } while ($row_rsKelas = mysql_fetch_assoc($rsKelas));
- $rows = mysql_num_rows($rsKelas); ?>
- </select>
- </select></td>
- </tr>
- <tr valign="baseline">
- <td nowrap align="right"> </td>
- <td><input type="submit" value="Insert record" name="btnSubmit"></td>
- </tr>
- </table>
- <p> </p>
- <p align="center"><a href="senaraidaftar.php" class="style2">BACK</a>
- <input type="hidden" name="MM_insert" value="form2">
- </p>
- </form>
- <p> </p>
- </body>
- </html>
Add Comment
Please, Sign In to add comment