PHP

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsWeb Design & DevelopmentPHP

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old November 21st, 2012, 03:24 AM
fathyn fathyn is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 1 fathyn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 22 sec
Reputation Power: 0
I need help!

i know only a bit about php. i am doing my intern now and my boss asked me to do a web based system. here is my code:



<!DOCTYPE HTML>
<html>
<head>

<title>Example : MySite</title>

<link rel="stylesheet" type="text/css" href="css/styles.css" media="all">

<!-- <script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>-->
</head>


<!--



<?php
//mandatory field symbol
$mandatory = "<font color='red'> <i>*</i>";
//global variable for result etc
global $result, $disp, $msg;
//connect to db first
require_once('connection/db.php');

if(isset($_POST['daftar'])){
$result = "";

//prevent sql injection - mysql_escape_string
$nama_penuh = mysql_escape_string($_POST['nama_penuh']);


if(empty($nama_penuh))
$result = "Sila masukkan nama penuh anda!";


//selebihnya ko buat validate sendiri ya


if($result != ""){
$msg .= "<div class='warning'>".$result."</div>";
$disp = 1;
} else {


$query = "INSERT INTO maklumat_peribadi SET
nama_penuh = '".$nama_penuh."',
no_ic = '".$no_ic."',
alamat_ttp = '".$alamat_ttp."',
no_rumah= '".$no_rumah."',
no_bimbit = '".$no_bimbit."',
jantina = '".$jantina."',
tmpt_lhir = '".$tmpt_lhir."',
email = '".$email."',
agama = '".$agama."',
bangsa = '".$bangsa."',
negara = '".$negara."',
nama_penjaga = '".$nama_penjaga."',
nama_ibu = '".$nama_ibu."'";


mysql_query($query);

$msg .= "<div class='success'>Pendaftaran telah berjaya dilakukan</div>";
$disp = 1;
}

}




?>

<body>
<div id="container">
<div id="content">
<div class="header">
<h3>
<div class="left">
<a href="#">LAMAN UTAMA</a>|
<a href="#">MAKLUMAT KURSUS</a>|
<a href="#">HUBUNGI KAMI</a>
</div>
</h3>
</div>
<div align="center" style="margin-top:10px;"><marquee behavior="scroll" direction="left"><?php echo date("d / m /Y") ;?></marquee></div>
<?php if($disp) echo $msg; ?>
<h1>Kursus Yang Dipilih(Sila Rujuk Maklumat Kursus)</h1>
<form action="index.php" method="POST">
<table class="form">
<tbody>
<tr>
<td class="left">Pilihan Pertama : <?php echo $mandatory ?> </font></td>
<td class="left">
<select name="pilihan_pertama" size="1">
<option>Sijil Teknologi Maklumat-(CSM)</option>
<option>Sijil Teknologi Pembuatan-CPD</option>
<option>Sijil Teknologi Kimpalan-CWE</option>
<option>Sijil Teknologi Automotif-CAT</option>
<option>Sijil Teknologi Elektrik-CEE</option>
<option>Sijil Kejuruteraan Pertanian-CAE</option>
<option>Sijil Senireka Fesyen-CFD</option>
<option>Diploma Kemahiran Tinggi-DKT</option>
<option>Diploma Kemahiran Malaysia-DKM</option>
</select></b> </div></td>
</td>
</tr>
<tr>
<td class="left">Pilihan Kedua : <?php echo $mandatory ?> </font></td>
<td class="left">
<select name="pilihan_kedua" size="1">
<option selected="selected">-- Sila pilih kursus --</option>
<option>Sijil Teknologi Maklumat-CCS</option>
<option>Sijil Teknologi Pembuatan-CPD</option>
<option>Sijil Teknologi Kimpalan-CWE</option>
<option>Sijil Teknologi Automotif-CAT</option>
<option>Sijil Teknologi Elektrik-CEE</option>
<option>Sijil Kejuruteraan Pertanian-CAE</option>
<option>Sijil Senireka Fesyen-CFD</option>
<option>Diploma Kemahiran Tinggi-DKT</option>
<option>Diploma Kemahiran Malaysia-DKM</option>
</td>
</tr>
</tbody>
</table>
<h1>Maklumat Peribadi Pemohon</h1>
<table class="form">
<tbody>
<tr>
<td class="left">Nama Penuh: <?php echo $mandatory ?></td>
<td class="left"><input name="nama_penuh" type="text" size="30" maxlength="60" /></td>
</tr>
<tr>
<td class="left">No. Kad Pengenalan: <?php echo $mandatory ?></td>
<td class="left"><input name="ic_no" type="text" size="30" maxlength="60" /></td>
</tr>
<tr>
<td class="left">Alamat Tetap: <?php echo $mandatory ?></td>
<td class="left"><input name="address" type="text" size="30" maxlength="60" /></td>
</tr>
<tr>
<td class="left">No. Telefon Rumah: <?php echo $mandatory ?></td>
<td class="left"><input name="telephone" type="text" size="30" maxlength="60" /></td>
</tr>
<tr>
<td class="left">No. Telefon Bimbit: <?php echo $mandatory ?></td>
<td class="left"><input name="hp_no" type="text" size="30" maxlength="60" /></td>
</tr>
<tr>
<td class="left">Jantina: <?php echo $mandatory ?></td>
<td class="left">
<select name="jantina">
<option>Lelaki</option>
<option>Perempuan</option>
</select>
</td>
</tr>
<tr>
<td class="left">Tempat Lahir: <?php echo $mandatory ?></td>
<td class="left"><input name="place_of_birth" type="text" size="30" maxlength="60" /></td>
</tr>
<tr>
<td class="left">Email: <?php echo $mandatory ?></td>
<td class="left"><input name="email" type="text" size="30" maxlength="60" /></td>
</tr>
<tr>
<td class="left">Agama: <?php echo $mandatory ?></td>
<td class="left">
<select name="agama">
<option>Islam</option>
<option>Buddha</option>
<option>Hindu </option>
<option>Kristian</option>
<option>Lain-lain</option>
</select></td>
</td>
</tr>
<tr>
<td class="left">Bangsa: <?php echo $mandatory ?></td>
<td class="left"><input name="race" type="text" size="30" maxlength="60" /></td>
</tr>
<tr>
<td class="left">Warganegara: <?php echo $mandatory ?></td>
<td class="left"><input name="nationality" type="text" size="30" maxlength="60" /></td>
</tr>
<tr>
<td class="left">Nama Bapa/Penjaga: <?php echo $mandatory ?></td>
<td class="left"><input name="maiden_name" type="text" size="30" maxlength="60" /></td>
</tr>
<tr>
<td class="left">Nama Ibu: <?php echo $mandatory ?></td>
<td class="left"><input name="mother_name" type="text" size="30" maxlength="60" /></td>
</tr>

</tbody>
</table>
<h1>Maklumat Keputusan Peperiksaan SPM/STPM</h1>
<table class="list">
<thead>
<td>Matapelajaran</td><td>Keputusan</td>
</thead>
<tbody>
<tr>
<td class="left">Bahasa Melayu</td>
<td class="center">
<select name="bahasa_melayu">
<option>A+</option>
<option>A</option>
<option>A-</option>
<option>B+</option>
<option>B</option>
<option>B-</option>
<option>C+</option>
<option>C</option>
<option>C-</option>
<option>D+</option>
<option>D</option>
<option>E</option>
<option>F</option>
</select>
</td>
</tr>
<tr>
<td class="left">Bahasa Inggeris</td>
<td class="center">
<select name="bahasa_inggeris">
<option>A+</option>
<option>A</option>
<option>A-</option>
<option>B+</option>
<option>B</option>
<option>B-</option>
<option>C+</option>
<option>C</option>
<option>C-</option>
<option>D+</option>
<option>D</option>
<option>E</option>
<option>F</option>
</select>
</td>
</tr>
<tr>
<td class="left">Matematik</td>
<td class="center">
<select name="matematik">
<option>A+</option>
<option>A</option>
<option>A-</option>
<option>B+</option>
<option>B</option>
<option>B-</option>
<option>C+</option>
<option>C</option>
<option>C-</option>
<option>D+</option>
<option>D</option>
<option>E</option>
<option>F</option>
</select>
</td>
</tr>
<tr>
<td class="left">Sains</td>
<td class="center">
<select name="sains">
<option>A+</option>
<option>A</option>
<option>A-</option>
<option>B+</option>
<option>B</option>
<option>B-</option>
<option>C+</option>
<option>C</option>
<option>C-</option>
<option>D+</option>
<option>D</option>
<option>E</option>
<option>F</option>
</select>
</td>
</tr>
<tr>
<td class="left">Fizik</td>
<td class="center">
<select name="fizik">
<option>A+</option>
<option>A</option>
<option>A-</option>
<option>B+</option>
<option>B</option>
<option>B-</option>
<option>C+</option>
<option>C</option>
<option>C-</option>
<option>D+</option>
<option>D</option>
<option>E</option>
<option>F</option>
</select>
</td>
</tr>
<tr>
<td class="left">Kimia</td>
<td class="center">
<select name="kimia">
<option>A+</option>
<option>A</option>
<option>A-</option>
<option>B+</option>
<option>B</option>
<option>B-</option>
<option>C+</option>
<option>C</option>
<option>C-</option>
<option>D+</option>
<option>D</option>
<option>E</option>
<option>F</option>
</select>
</td>
</tr>
<tr>
<td class="left">Pengajian Am</td>
<td class="center">
<select name="pengajian_am">
<option>A+</option>
<option>A</option>
<option>A-</option>
<option>B+</option>
<option>B</option>
<option>B-</option>
<option>C+</option>
<option>C</option>
<option>C-</option>
<option>D+</option>
<option>D</option>
<option>E</option>
<option>F</option>
</select>
</td>
</tr>
<tr>
<td class="left"><input name="inputA" type="text" size="60"/></td>
<td class="center">
<select name="vA">
<option>A+</option>
<option>A</option>
<option>A-</option>
<option>B+</option>
<option>B</option>
<option>B-</option>
<option>C+</option>
<option>C</option>
<option>C-</option>
<option>D+</option>
<option>D</option>
<option>E</option>
<option>F</option>
</select>
</td>
</tr>
<tr>
<td class="left"><input name="inputB" type="text" size="60"/></td>
<td class="center">
<select name="vB">
<option>A+</option>
<option>A</option>
<option>A-</option>
<option>B+</option>
<option>B</option>
<option>B-</option>
<option>C+</option>
<option>C</option>
<option>C-</option>
<option>D+</option>
<option>D</option>
<option>E</option>
<option>F</option>
</select>
</td>
</tr>
<tr>
<td class="left"><input name="inputC" type="text" size="60"/></td>
<td class="center">
<select name="vC">
<option>A+</option>
<option>A</option>
<option>A-</option>
<option>B+</option>
<option>B</option>
<option>B-</option>
<option>C+</option>
<option>C</option>
<option>C-</option>
<option>D+</option>
<option>D</option>
<option>E</option>
<option>F</option>
</select>
</td>
</tr>
</tbody>
</table>
<div style="margin:auto;width:100%;text-align:center;">
<input type="submit" name="daftar" class="button" value="Submit">
<input type="submit" name="reset" class="button" value="Reset">
</div>
</form>
</div>
</div>
</body>




only nama penuh appear in database. and after i hit button submit, this appea at my web:

Notice: Undefined variable: no_ic in D:\xampp\htdocs\ftn_eg\index.php on line 59

Notice: Undefined variable: alamat_ttp in D:\xampp\htdocs\ftn_eg\index.php on line 60

Notice: Undefined variable: no_rumah in D:\xampp\htdocs\ftn_eg\index.php on line 61

Notice: Undefined variable: no_bimbit in D:\xampp\htdocs\ftn_eg\index.php on line 62

Notice: Undefined variable: jantina in D:\xampp\htdocs\ftn_eg\index.php on line 63

Notice: Undefined variable: tmpt_lhir in D:\xampp\htdocs\ftn_eg\index.php on line 64

Notice: Undefined variable: email in D:\xampp\htdocs\ftn_eg\index.php on line 65

Notice: Undefined variable: agama in D:\xampp\htdocs\ftn_eg\index.php on line 66

Notice: Undefined variable: bangsa in D:\xampp\htdocs\ftn_eg\index.php on line 67

Notice: Undefined variable: negara in D:\xampp\htdocs\ftn_eg\index.php on line 68

Notice: Undefined variable: nama_penjaga in D:\xampp\htdocs\ftn_eg\index.php on line 69

Notice: Undefined variable: nama_ibu in D:\xampp\htdocs\ftn_eg\index.php on line 70

what should i do? i really need help.

Reply With Quote
Reply

Viewing: Tutorialized ForumsWeb Design & DevelopmentPHP > I need help!


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap