inputnya

Rheyank Iwan Nytt · Jan 28, 2013
mas mhon bantuannya ...
inputnya gagal ne file inputnya mas ...
<!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=utf-8" />
<title>English Lesson Of Grammar</title>
<link href="css/rheyank_style.css" rel="stylesheet" type="text/css" />

<link rel="stylesheet" type="text/css" href="css/ddsmoothmenu.css" />

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/ddsmoothmenu.js">

/***********************************************
* Smooth Navigational Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

<script type="text/javascript">

ddsmoothmenu.init({
	mainmenuid: "menu", //menu DIV id
	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
	classname: 'ddsmoothmenu', //class added to menu's outer DIV
	//customtheme: ["#1c5a80", "#18374a"],
	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

</script>
<style type="text/css">
<!--
.style1 {color: #75a62c}
.style2 {
	color: #333;
	font-weight: bold;
}
-->
</style>
</head>
<body>

<div id="body">
	<div id="header"></div> 
	<!-- end of header -->
    
    <div id="menu" class="ddsmoothmenu">
        <ul>
            <li><a href="index.php">Home</a></li>
            <li><a href="grammar.php">Grammar</a></li>
          	<li><a href="soal.php" class="selected">Excercise</a></li>
          	<li><a href="about.php">About</a></li>
        </ul>
        <br style="clear: left" />
    </div> <!-- end of menu -->

    <div id="main">    	
	    <h2>Masukan Data Diri Anda !!! </h2>
        <div class="col_2 float_l">
            <br class="cleaner h20" />
            <div id="data_form">
                <form method="post" name="data" action="simpan.php">
                        
                        <label for="nis">NIS</label> <input type="text" id="nis" name="nis" class="input" />
                        <div class="cleaner h10"></div>
                        <label for="nama">Nama</label> <input type="text" id="nama" name="nama" class="input" />
                        <div class="cleaner h10"></div>
                        <label for="kelas">Kelas</label> <input type="text" name="kelas" id="kelas" class="input" />
						<div class="cleaner h10"></div>
                               
                        <input type="submit" value="Daftar" id="submit" name="submit" class="submit_btn float_l" />
						<input type="reset" value="Reset" id="reset" name="reset" class="submit_btn float_r" />
                        
            	</form>
            </div> 
        </div>
		        <div class="col_2 float_l">
        
        	<h4 class="style1">Petunjuk ..</h4>
			<p align="justify">Sebelum anda mangerjakan soal latihan, Anda diharuskan untuk mengisi data diri anda pada form yang ada disebelah kiri tersebut. Setelah itu tekan <span class="style2">&quot;Daftar&quot;</span>. Maka anda akan menuju ke soal latihan yang tersedia. </p>
			<p align="justify">Jika anda sudah terdaftar, silakan tekan <span class="style2">&quot;Lanjut&quot;</span> untuk menuju soal latihan yang sudah tersedia.</p>
			<p align="justify">Soal ini terdiri dari <span class="style2">20 soal pilihan ganda dan 5 soal esai</span>.</p>
			<p align="justify">Selamat mengerjakan !!! </p>
                     <div class="cleaner h10"></div>
            <a href="#" class="more">Lanjut</a>
   
        </div>
        
		        <br class="cleaner" />
    </div> <!-- end of main -->
    
    <div id="footer">
    	            <div class="footer_social_button">
                <a href="#"><img src="images/facebook-32x32.png" title="facebook" alt="facebook" /></a>
                <a href="#"><img src="images/flickr-32x32.png" title="flickr" alt="flickr" /></a>
                <a href="#"><img src="images/twitter-32x32.png" title="twitter" alt="twitter" /></a>
                <a href="#"><img src="images/youtube-32x32.png" title="youtube" alt="youtube" /></a>
                <a href="#"><img src="images/rss-32x32.png" title="rss" alt="rss" /></a>
			</div>       		
  </div>
        <div class="cleaner"></div>
</div> <!-- end of footer -->

<div id="cr_bar_wrapper">
	<div id="cr_bar">
    	Copyright © 2013 Designed by <a href="http://www.facebook.com/rheyank.iwan">Rheyank Iwan</a>    </div>
</div>

</body>
</html>


ne simpannya mas
<?
//Cek Tombol 
if ($_POST){
//Kirimkan Variabel
$nis = $_POST['nis'];
$nama = $_POST['nama'];
$kelas = $_POST['kelas'];

//validasi data jika nama dan pesan kosong
if (empty($_POST['nis'])|| empty($_POST['nama'])|| empty($_POST['kelas'])) 
{
?>
<script language="JavaScript">
alert('Data Harap Dilengkapi');
document.location='input.php';
</script>
<?
}
//Jika Validasi Terpenuhi
else
{
//Memanggil File Koneksi Database
	$qlname = "root";  // username
	$qlpass = "12345";  // password
	$qlserver = "localhost"; // server
	$qldbase = "english"; // database name

//Masukan data ke Table siswa
$tambah="INSERT INTO siswa VALUES('$nis','$nama','$kelas')";
$query_tambah=mysql_db_query($db,$tambah,$conn_db);
if ($query_tambah)
{
//Jika Sukses
//echo "Data telah diinput";
?>
<script language="JavaScript">
alert('Data Berhasil diinput');
document.location='soal.php';
</script>
<?

}
else
{
//Jika Gagal
//echo "Data gagal diinput, Silakan Ulangi";
}
}
}
?>
<script language="JavaScript">
alert('Data Gagal diinput,, Silakan ulangi');
document.location='input.php';
</script>


tlong ea mas.....
sukses bwt mas ellyx
Silahkan login untuk menjawab!
0
Loading...
Rheyank Iwan Nytt · Jan 28, 2013 · 0 Suka · 0 Tidak Suka
oea mas ,, untuk struktur tabelnya
nis int(11) primary key, auto_increment
nama varchar (50)
kelas varchar (20)
0
Loading...
Ellyx Christian · Jan 29, 2013 · 0 Suka · 0 Tidak Suka
coba tambahkan or die(mysql_error()); pada baris ke-30: seperti
$query_tambah=mysql_db_query($db,$tambah,$conn_db) or die(mysql_error());

kemudian liat apa errornya
0
Loading...
Rheyank Iwan Nytt · Jan 30, 2013 · 0 Suka · 0 Tidak Suka
seperti ini mas erornya
Warning: mysql_db_query(): supplied argument is not a valid MySQL-Link resource in C:\AppServ\www\MyTA\simpan.php on line 30
0
Loading...
Ellyx Christian · Jan 30, 2013 · 0 Suka · 0 Tidak Suka
0
Loading...
Rheyank Iwan Nytt · Jan 31, 2013 · 0 Suka · 0 Tidak Suka
thanks ea mas ,, alhamdulillah da bsa connect ...

mw tanya lagi mas ,, untuk menampilkan data di atas yang sudah di inputkan gmn mas ??? ditampilkan bersama form soalnya mas ..

jdi di atas soal" ada form untuk data siswanya gtu,, pke text field mas ,,,,
pa kah scriptnya sma dengan untuk menampilkan dta untuk edit ???
0
Loading...
Rheyank Iwan Nytt · Jan 31, 2013 · 0 Suka · 0 Tidak Suka
ne script soalnya...
<!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=utf-8" />
<title>English Lesson Of Grammar</title>
<link href="css/rheyank_style.css" rel="stylesheet" type="text/css" />

<link rel="stylesheet" type="text/css" href="css/ddsmoothmenu.css" />

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/ddsmoothmenu.js">

/***********************************************
* Smooth Navigational Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

<script type="text/javascript">

ddsmoothmenu.init({
	mainmenuid: "menu", //menu DIV id
	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
	classname: 'ddsmoothmenu', //class added to menu's outer DIV
	//customtheme: ["#1c5a80", "#18374a"],
	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

</script></head>
<body>

<div id="body">
	<div id="header"></div> 
	<!-- end of header -->
    
    <div id="menu" class="ddsmoothmenu">
        <ul>
            <li><a href="index.php">Home</a></li>
            <li><a href="grammar.php">Grammar</a></li>
          	<li><a href="soal.php" class="selected">Excercise</a></li>
          	<li><a href="about.php">About</a></li>
        </ul>
        <br style="clear: left" />
    </div> <!-- end of menu -->

    <div id="main">
	        <div class="col_l">
        	<h2>Exercise</h2>
<?php
// DATABASE
	$qlname = "root";  // username
	$qlpass = "12345";  // password
	$qlserver = "localhost"; // server
	$qldbase = "english"; // database name

// jumlah soal yang ditampilkan
	$jml = 5;

mysql_connect($qlserver,$qlname,$qlpass);
$conn = mysql_select_db($qldbase);
if(!$conn)
{
	echo 'Can\'t find database, maybe server down .....';
	exit;
}


if($_POST['user']=="jawab")
{
	for($i=1; $i<=$jml; $i++)
	{
		$ns = $_POST["s_".$i.""];
		$jb = $_POST["j_".$i.""];
		$jwb = mysql_query("select * from soal where id='".$ns."' and jbenar='".$jb."'");
		if(mysql_num_rows($jwb)==0)
		{
			$nilai[$i] = 0;
			if($jb)
				echo 'Jawaban Soal No. '.$i.' - '.$jb.' : <FONT COLOR="red">SALAH</FONT><BR>';
			else
				echo 'Tidak menjawab soal nomor '.$i.'<br>';
		}
		else
		{
			$nilai[$i] = 1;
			if($jb)
				echo 'Jawaban Soal No. '.$i.' - '.$jb.' : BENAR<BR>';
		
		// Tempat masukkan jawaban dalam database

		// Tempat masukkan jawaban dalam database end
		}
		
	}
	// REKAP NILAI
	$nbenar = array_sum($nilai);
	$nsalah = $jml-$nbenar;
	$ntotal = number_format($nbenar/$jml*100,1);
	if($nbenar>0)
	{
		echo '<br>Rekap Nilai:<br>';
		echo '- Jawaban benar : '.$nbenar.' soal<br>';
		echo '- Jawaban salah : '.$nsalah.' soal<br>';

		// KATEGORI
		// Jenius = >=90
		// Pintar = 80 - 90
		// Sedang = 70 - 80
		// Bodoh = 60 - 70
		// Sangat Bodoh = < 60
			if($ntotal>=90)
				$k = 'Jenius';
			elseif($ntotal>=80 && $ntotal<90)
				$k = 'Pintar';
			elseif($ntotal>=70 && $ntotal<80)
				$k = 'Sedang';
			elseif($ntotal>=60 && $ntotal<70)
				$k = '<FONT COLOR="red">Bodoh</FONT>';
			else
				$k = '<FONT COLOR="red">Sangat Bodoh</FONT>';
		// KATEGORI END

		echo '- Nilai Total : '.$ntotal.' dari 100 dan Anda termasuk <B><U>'.$k.'</U></B><br>';
	}
	echo '<br \><A HREF="'.$_PPHP['SELF'].'">Kembali ke soal</A><br \>';
}
else
{
echo '<FORM METHOD="POST" ACTION="">
<INPUT TYPE="hidden" NAME="user" value="jawab">';
echo '<B>Jawablah soal-soal dibawah ini dengan benar</B>';
echo '<OL>';
$sx = mysql_query("SELECT * FROM soal ORDER BY RAND() LIMIT $jml");
$no = 1;
while($x=mysql_fetch_array($sx))
{
	echo '<INPUT TYPE="hidden" NAME="s_'.$no.'" value="'.$x[id].'">';
	echo '<LI>'.$x[soal].'<br>';
	// pilihan 
	echo '<INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j1].'">'. $x[j1].' ';
	echo '<INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j2].'">'. $x[j2].' ';
	echo '<INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j3].'">'. $x[j3].' ';
	echo '<INPUT TYPE="radio" NAME="j_'.$no.'" value="'.$x[j4].'">'. $x[j4].' ';
	echo'</LI>';
	$no++;
}
echo '</OL>';
echo '<INPUT TYPE="submit" class="more" value="Jawab Soal">
</FORM>';
}
?>
            <div class="cleaner h20"></div>
            <a href="#" class="more">More</a>
            <br class="cleaner" />
        </div>
		<br class="cleaner" />
    </div> <!-- end of main -->
    
    <div id="footer">
    	            <div class="footer_social_button">
                <a href="#"><img src="images/facebook-32x32.png" title="facebook" alt="facebook" /></a>
                <a href="#"><img src="images/flickr-32x32.png" title="flickr" alt="flickr" /></a>
                <a href="#"><img src="images/twitter-32x32.png" title="twitter" alt="twitter" /></a>
                <a href="#"><img src="images/youtube-32x32.png" title="youtube" alt="youtube" /></a>
                <a href="#"><img src="images/rss-32x32.png" title="rss" alt="rss" /></a>
			</div>       		
  </div>
        <div class="cleaner"></div>
</div> <!-- end of footer -->

<div id="cr_bar_wrapper">
	<div id="cr_bar">
    	Copyright © 2013 Designed by <a href="http://www.facebook.com/rheyank.iwan">Rheyank Iwan</a>    </div>
</div>

</body>
</html>
0
Loading...
Rheyank Iwan Nytt · Feb 5, 2013 · 0 Suka · 0 Tidak Suka
mas nanya lagi dunk ,,,
disini ada beberapa materi,, misalnya materi bab 1, bab 2, dan bab 3,, trs masing" materi da soal tersendiri,,
stelah tu q mw bwt sperti ujian UTS misalnya ,, jadi dari ke 3 materi tadi di ambil beberapa soal,, gmn tu mas ???? untuk struktur tabelnya pda materi 1,2,3 sama,,
id* int 6
soal varchar 255
j1 vachar 255
j2 varchar 255
j3 varchar 255
j4 varchar 255
kunci varchar 255
tlong ea mas ,,

1 lgi mas,,
misal,, manakah yang termasuk hewan ???
A. apel
B. kucing
C. sapi
D. anjing
trs ketika da jwaban yang salah tu muncul pemberitahuan jawaban A salah karena bukan hewan
tu gmn mas ...
tlong ea mas