|
try letak echo macam i212 cakap
echo $Query="UPDATE temujanji SET status='$status' WHERE nokp='$nokp' AND bil=$bil ";
lepas tu copy & paste kat phpmyadmin
kalau integer nak letak '' atau tak pun takpe |
|
|
|
|
|
|
|
Balas #101 BorderManager\ catat
kalau integer nak letak '' atau tak pun takpe
oooo.. php tak check ke type tu.. heheheh.. ingatkan check...
ko dah brapa taun dalam php border? |
|
|
|
|
|
|
|
biasa aku telak '' & tak letak sama je
hehe bulan 2 n genap 6 bulan belajor php.... masih mentah lagi |
|
|
|
|
|
|
|
Originally posted by BorderManager at 2-2-2009 07:11 PM
biasa aku telak '' & tak letak sama je
hehe bulan 2 n genap 6 bulan belajor php.... masih mentah lagi
wah...6 bulan blaja dah xpert ... |
|
|
|
|
|
|
|
dah buleh dah..ader konflik textfield...ader 2 textfield name bil..patotla xdetect....tq...
boardmanager...yg pasal popup tu cane?..yg kat page blakang.. |
|
|
|
|
|
|
|
lagi 1 pasal code utk insert...
ader 2 page..page A n B
dr page A aku nak ke Page B....
so kat page B tu la tmpt aku nak isi data n save...
tpkan..bila aku masuk je page B tu..trus kuar msgbox data telah disimpan....
patutnya msgbox tu kuar kelpas aku isi data n klik save..
sbb ape ye? |
|
|
|
|
|
|
|
mai nak tengok coding ko bab popup tu
if($_POST['form'])
{
echo 'message';
}
else
{
echo 'form';
}
mcm n ke??? tak berapa faham soalan |
|
|
|
|
|
|
|
Originally posted by BorderManager at 3-2-2009 01:11 AM
mai nak tengok coding ko bab popup tu
if($_POST['form'])
{
   echo 'message';
}
else
{
   echo 'form';
}
mcm n ke??? tak berapa faham soalan
xpaham soklan ek...hihi...
kat page B tu aku ader wat coding Insert utk simpan data dlm dB...patutnye bile kite masuk maklumat2 n then kite klik button save baru dier simpan dlm dB n kuar msgbox la btau yg data dah disimpan.......tp ni..bile je aku bukak page B tu trus dier simpan data n kuar msgbox...x tekan button save lagi...tp data yg disimpan tu xde la sbb maklumat x disi lagik.. ni code page B tu...
<?
date_default_timezone_set('Asia/Kuala_Lumpur');
session_start();
if(!session_is_registered(nokp)){
header("location:loginpelajar.php");
exit();
}
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="1234"; // Mysql password
$db_name="nurani"; // Database name
$tbl_name="mesejpelajar"; // Table name
$db = mysql_connect($host, $username, $password);
if (!$db)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db($db_name,$db);
$sql =  "SELECT * FROM inboxpelajar WHERE perkara = '".$_GET['perkara']."'"; 
$result = mysql_query($sql) or die("SQL select statement failed");
   while($row = mysql_fetch_array($result))
  {
 $perkara=$row["perkara"];
 $mesej=$row["mesej"];
 $pengirim2=$row["pengirim2"];
 $nokp2=$row["nokp2"];
     }
$pengirim2=$_POST['pengirim2']; 
$perkara=$_POST['perkara']; 
$nokp2=$_POST['nokp2'];
$nokp=$_POST['nokp'];
$pengirim=$_POST['pengirim']; 
 
?>
<html>
<script language=javascript>
 function validated(){
                 var pengirim2 = document.s.pengirim2.value;
                 var perkara = document.s.perkara.value;
                 var mesej = document.s.mesej.value;
                          
                          if(pengirim2==""){ 
                         window.alert("Sila Isikan Ruangan pengirim Anda!");
                         document.s.pengirim2.focus();
                         return false;
                 }
                 if(perkara==""){ 
                         window.alert("lease write your perkara!");
                         document.s.perkara.focus();
                         return false;
                 }
                 if(mesej==""){ 
                         window.alert("lease write your mesej!");
                         document.s.mesej.focus();
                         return false;
                 }
                 else
                 return true; 
                 }
 
                 </script>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" c>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
 <link rel="stylesheet" type="text/css" href="style2.css" />
</head>
<script type="text/javascript">
function check()
{
 
         alert("No data to delete");
  
}
</script>
<body>
<div id="Layer4" style="position:absolute; left:420px; top:86px; width:603px; height:483px; z-index:4"> 
  <br> <?php
if (isset($_REQUEST['Submit'])) {
$sql = "INSERT INTO mesejpelajar (perkara,mesej,pengirim,nokp,nokp2) values ('".mysql_real_escape_string(stripslashes($_REQUEST['perkara']))."','".mysql_real_escape_string(stripslashes($_REQUEST['mesej']))."','".mysql_real_escape_string(stripslashes($_REQUEST['pengirim']))."' ,'".mysql_real_escape_string(stripslashes($_REQUEST['nokp']))."' ,'".mysql_real_escape_string(stripslashes($_REQUEST['nokp2']))."' )";
if($result = mysql_query($sql ,$db)) {
echo "";  ?>
                 <script language=javascript>
                 window.alert ("Mesej Telah Dihantar");
                  </script> <?
} else {
echo "ERROR: ".mysql_error();
}
} else {}
?>
 
  <table width="75%" border="1"><form name="form1" method="post" action="balaspelajar.php" name='s' onsubmit='return validated()'>  
<input name="nokp2" type="text" id="nokp2" size="12" value="<?php echo"$nokp2"; ?>" readonly>
<input name="nokp" type="text" id="nokp" size="12" value="<?php echo"$nokp"; ?>" readonly>
<input name="pengirim" type="text" id="pengirim" size="12" value="<?php echo"$pengirim"; ?>" readonly>
    <tr> 
      <td bgcolor="#FEF6E2"><strong><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Kepada</font></strong></td>
    </tr>
    <tr> 
      <td bgcolor="#FEF6E2"><input name="pengirim2" type="text" id="pengirim2" size="50" value="<?php echo"$pengirim2"; ?>" readonly>
        <font size="2"> </font></td>
    </tr>
    <tr> 
      <td bgcolor="#FEF6E2"><strong><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">erkara</font></strong></td>
    </tr>
    <tr> 
      <td bgcolor="#FEF6E2"><font size="2"><input name="perkara" type="text" id="perkara" size="50" value="Re:<?php echo"$perkara"; ?>" >
        </font></td>
    </tr>
    <tr> 
      <td bgcolor="#FEF6E2"><strong><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">Mesej</font></strong></td>
    </tr>
    <tr> 
      <td bgcolor="#FEF6E2"><font size="2"> </font> 
    
          <textarea name="mesej" cols="70" rows="10" id="mesej"  ></textarea>
       </td>
    </tr>
  </table>
  
    <input type="submit" name="Submit" value="Hantar">
  </form> |
|
|
|
|
|
|
|
ni lak yg popup tu...
Page 1....tmpt search data n 
<?
session_start();
if(!session_is_registered(nokp2)){
header("location:loginkaunselor.php");
exit();
}
$con = mysql_connect("localhost","root","1234");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("nurani", $con);
$sql = "SELECT * FROM kaunselor WHERE nokp2 = '". $_SESSION['nokp2'] ."'"; 
$result = mysql_query($sql) or die("SQL select statement failed");
while ($row = mysql_fetch_array($result)) {
  $nama2=$row["nama"];
  $email=$row["email"];
     
  }
     
  ?>
<html >
<script language=javascript>
 function validated(){
 var nokp = document.form1.nokp.value;
   if(nokp==""){ 
  window.alert("Sila Isikan Ruangan Nombor Matrik Pelajar!");
  document.form1.nokp.focus();
  return false;
 }
}
  </script>
<head>
<meta http-equiv="Content-Type" c />
<title>Hostel Electrical Appliances Registration System [ HEARS ]</title>
<link rel="stylesheet" type="text/css" href="style2.css" />
</head>
<body >
<p align="center"> </p>
<div id="Layer4" style="position:absolute; left:420px; top:86px; width:603px; height:211px; z-index:4"> 
  <p><div align="center"></div><br/>
<table width="97%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr>
  <td bordercolor="#FFFFCC" bgcolor="#FEF6E2"> 
  <p align="center"><strong><font color="#000000">Sila Masukkan No Kad Pengenalan 
  Pelajar</font></strong></p>
  <p align="center"> 
  <form action = "borangjumpa.php" method="post" name="form1" class="menu" id="form1" onsubmit='return validated()'>
  <div align="center">
  <label></label>
  <label> 
  <input name="nokp" type="text" size="25" maxlength="200" />
  <input class="butang" name="Search" type="submit" value="Cari" />
  <input class="butang" name="reset" type="reset" value="Reset" />
  </label>
  </div>
  </form>
  <p></p></td>
  </tr>
</table>
<p>
  <?php
  $nokp=$_POST['nokp'];
   
  $con = mysql_connect("localhost","root","1234");
  if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
  
  mysql_select_db("nurani", $con);
   
   
  $Query="SELECT * from pelajar where nokp = '$nokp' ";
  $dbresult=mysql_query($Query);
   
   
  if(mysql_num_rows($dbresult) >0)
  {
  while($row=mysql_fetch_row($dbresult))
  {
   
   
  echo "<form method=post name=form1 action=borangjumpa2.php >
  <table align=center border=1 width=97% bgcolor=#FEF6E2>
  <tr>
  <td>
  <font color=#000000 size=2 face=Verdana, Arial, Helvetica, sans-serif><table width=75% border=0 align=center >
  <tr> 
  <td><div align=center><strong>UNIT BIMBINGAN DAN KAUNSELING</strong></div></td>
  </tr>
</table><br>
<table width=52% border=0 align=center>
  <tr>
  <td><div align=center>BORANG PERMOHONAN INGIN BERJUMPA PELAJAR </div></td>
  </tr>
</table>
<br>
<div align=center><table width=82% border=0></div>
  <tr>
  <td>Saya 
  <input name=nama type=text id=nama size=50 value = '$nama2' readonly=true>
  (Guru Kaunseling) 
  <p> Ingin berjumpa dengan 
  <input name=nama2 type=text id=nama2 size=50 value = '$row[2]' readonly=true>
  (Nama Pelajar) </p>
  <p> Tingkatan: 
  <input name=tingkatan type=text id=tingkatan size=50 value = '$row[10]' readonly=true>
  <br>
  <br>
  Pada: Hari : 
  <select name=hari id=hari>
  <option>- Sila Pilih -</option>
  <option value=Isnin>Isnin</option>
  <option value=Selasa>Selasa</option>
  <option value=Rabu>Rabu</option>
  <option value=Khamis>Khamis</option>
  <option value=Jumaat>Jumaat</option>
  </select>
  Tarikh: 
  <select name=tarikh id=tarikh>
  <option>- Sila Pilih -</option>
  <option value=1>1</option>
  <option value=2>2</option>
  <option value=3>3</option>
  <option value=4>4</option>
  <option value=5>5</option>
  <option value=6>6</option>
  <option value=7>7</option>
  <option value=8>8</option>
  <option value=9>9</option>
  <option value=10>10</option>
  <option value=11>11</option>
  <option value=12>12</option>
  <option value=13>13</option>
  <option value=14>14</option>
  <option value=15>15</option>
  <option value=16>16</option>
  <option value=17>17</option>
  <option value=18>18</option>
  <option value=19>19</option>
  <option value=20>20</option>
  <option value=21>21</option>
  <option value=22>22</option>
  <option value=23>23</option>
  <option value=24>24</option>
  <option value=25>25</option>
  <option value=26>26</option>
  <option value=27>27</option>
  <option value=28>28</option>
  <option value=29>29</option>
  <option value=30>30</option>
  <option value=31>31</option>
  </select>
  <select name=tarikh2 id=tarikh2>
  <option>- Sila Pilih -</option>
  <option value=Januari>Januari</option>
  <option value=Februari>Februari</option>
  <option value=Mac>Mac</option>
  <option value=April>April</option>
  <option value=Mei>Mei</option>
  <option value=Jun>Jun</option>
  <option value=Julai>Julai</option>
  <option value=Ogos>Ogos</option>
  <option value=September>September</option>
  <option value=Oktober>Oktober</option>
  <option value=November>November</option>
  <option value=Disember>Disember</option>
  </select>
  <select name=tarikh3 id=tarikh3>
  <option>- Sila Pilih -</option>
  <option value=2008>2008</option>
  <option value=2009>2009</option>
  <option value=2010>2010</option>
  <option value=2011>2011</option>
  <option value=2012>2012</option>
  </select>
  </p>
  <p>Masa : 
  <input name=masa type=text id=masa size=10>
  <select name=masa2 id=select>
  <option>- Sila Pilih -</option>
  <option value=AM>AM</option>
  <option value=PM>PM</option>
  </select>
  </p>
  <p>Perkara yang ingin saya bincangkan adalah mengenai masalah yang di hadapinya.</p>
  <p>Sekian. Terima Kasih,</p>
  
</td>
</font>
  </tr>
</table></td>
  </tr>
</table>
<br/>  
<div align=center><input name=print type=submit id=print value=Papar onClick=window.open('borangjumpa2.php','mywindow','width=400,height=200' )> </div>
</form> ";
  }  
  } 
   
  else
  {
  echo " ";
  } 
   
 
  ?>
cth dier kat gmbr bwh nie..mule2 kene cari dulu by ic.....pastu dier akan kuar la maklumat peribadi...pastu just select yg sila pilih tu jela...pastu klik papar tu...dier patutnyer akan pegi ke popup mesej sbb aku nak print popup tu..nak wat white je..nanti kalo xwat popup dier akan print skali ngan banner seme..aku just nak print borang tu je..tu yg nak wat white je...
yg ni lak page 2...
<?
session_start();
if(!session_is_registered(nokp2)){
header("location:loginkaunselor.php");
exit();
}
$con = mysql_connect("localhost","root","1234");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("nurani", $con);
$sql = "SELECT * FROM kaunselor WHERE nokp2 = '". $_SESSION['nokp2'] ."'"; 
$result = mysql_query($sql) or die("SQL select statement failed");
while ($row = mysql_fetch_array($result)) {
  $nama=$row["nama"];
     
  }
        ?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" c>
</head>
<body >
  <?php
   
  $nama2=$_POST['nama2'];
  $tingkatan=$_POST['tingkatan'];
  $hari=$_POST['hari'];
  $tarikh=$_POST['tarikh'];
  $tarikh2=$_POST['tarikh2'];
  $tarikh3=$_POST['tarikh3'];
  $masa=$_POST['masa'];
  $masa2=$_POST['masa2'];
  ?>
  <form method="post" name="form1" action="borangjumpa3.php" >
<table width="75%" border="1" align="center">
  <tr>
  <td><p> </p>
  <table width="75%" border="0" align="center">
  <tr> 
  <td><div align=center><strong>UNIT BIMBINGAN DAN KAUNSELING</strong></div></td>
  </tr>
  </table>
  <br> <table width="52%" border="0" align="center">
  <tr> 
  <td><div align=center>BORANG PERMOHONAN INGIN BERJUMPA PELAJAR </div></td>
  </tr>
  </table>
  <p> </p>
  <table width="82%" border="0" align="center">
  <tr> 
  <td>Saya <strong><? echo"$nama";?></strong> (Guru Kaunseling) 
  <p> Ingin berjumpa dengan <strong><? echo"$nama2";?></strong> (Nama Pelajar) </p>
  <p> Tingkatan: <strong><? echo"$tingkatan";?></strong> <br>
  <br>
  Pada: Hari : <strong><? echo"$hari";?></strong> Tarikh: <strong><? echo"$tarikh";?><? echo"$tarikh2";?><? echo"$tarikh3";?></strong></p>
  <p>Masa : <strong><? echo"$masa";?><? echo"$masa2";?></strong></p>
  <p>Perkara yang ingin saya bincangkan adalah mengenai masalah yang 
  di hadapinya.</p>
  <p>Sekian. Terima Kasih,</p></td>
  </tr>
  </table></td>
  </tr>
</table>
 
<br>
<p align="center">--------------------------------------------------------------------------------------------</p>
<table width="75%" border="1" align="center">
  <tr> 
  <td><div align="center"><strong>UNIT BIMBINGAN DAN KAUNSELING</strong></div></td>
  </tr>
</table>
<br><table width="52%" border="1" align="center">
  <tr> 
  <td>BORANG KEBENARAN BERJUMPA KAUNSELOR </td>
  </tr>
</table>
<br/><table width="75%" border="1" align="center">
  <tr>
  <td><br/><p>Saya _____________________________________________________ (Guru Kelas)</p>
  <p> (Membenarkan/Tidak Membenarkan)</p>
  <p> (Nama Pelajar) <strong><? echo" $nama2" ?></strong> Tingkatan : <strong><? echo" $tingkatan" ?></strong></p>
  <p> Berjumpa tuan/ puan seperti tarikh dan masa yang di sebutkan di atas</p>
  Alasan (Jika Tidak Membenarkan) _________________________________________ 
  <p>Sekian. Terima Kasih,</p>
  <p>Yang Benar,<br>
  ………………………………………………<br>
  ( ______________________ )</p>
  <p> </p>
  </td>
  </tr>
</table>
<div align="center"><input name="print" type=submit id="print" value="Print" > </div>
</form>
so page ni la yg aku nak wat popup sebenarnyer...tp kalo tgk pada gmbr yg aku letak nie...seme maklumat tu dapat aku post...sbb aku wat popup...tp bile aku wat page ni sbg popup..dier tak post data2 tu..kenape yee?
|
|
|
|
|
|
|
|
cuba ko letak
print_r($_POST); kat line atas
maybe ko terPOST value Submit
tu yg jln script n
if (isset($_REQUEST['Submit'])) {
$sql = "INSERT INTO mesejpelajar (perkara,mesej,pengirim,nokp,nokp2) values ('".mysql_real_escape_string(stripslashes($_REQUEST['perkara']))."','".mysql_real_escape_string(stripslashes($_REQUEST['mesej']))."','".mysql_real_escape_string(stripslashes($_REQUEST['pengirim']))."' ,'".mysql_real_escape_string(stripslashes($_REQUEST['nokp']))."' ,'".mysql_real_escape_string(stripslashes($_REQUEST['nokp2']))."' )";
if($result = mysql_query($sql ,$db)) {
echo ""; ?>
} else {
echo "ERROR: ".mysql_error();
}
} else {}
?> |
|
|
|
|
|
|
|
Originally posted by BorderManager at 4-2-2009 12:12 AM
cuba ko letak
print_r($_POST); kat line atas
maybe ko terPOST value Submit
tu yg jln script n
if (isset($_REQUEST['Submit'])) {
$sql = "INSERT INTO mesejpelajar (perkara,mesej,pengir ...
print_r($_POST); ...yg ni utk ape?
tp yg submit tu...bile kite klik submit bru dier post kan?.....ke board ader care utk insert data yg lain? |
|
|
|
|
|
|
|
yg nak count tu caner...coding ni je ke?
$sql = "SELECT COUNT(*) FROM table WHERE email_status = 'unread'";
....pastu nak echo cane?... |
|
|
|
|
|
|
|
$sql = "SELECT COUNT(*) AS total FROM table WHERE email_status = 'unread'";
echo $row['total']; |
|
|
|
|
|
|
|
dah try...tp apesal dier bace jugak yg status read ek?.. |
|
|
|
|
|
|
|
board...cane nak p ke new window bile klik button..not popup..but new window.. |
|
|
|
|
|
|
|
kalau javascript
onclick="window.location='newpage.html'" |
|
|
|
|
|
|
|
yg status cane ek?...apesal yg status read pon dier count skali? |
|
|
|
|
|
|
|
Balas #117 pzan213\ catat
apa kata pastekan portion tuh... portion yang tunjukkan count tuh..
mungkin senang border nak bagi komen...
lagi satu.. dalam DB value dia read/unread ka atau 0/1 |
|
|
|
|
|
|
|
<? $sql = "SELECT COUNT (*) FROM mesejpelajar AS total WHERE status = 'Unread' "; ?>
aku isi kat dlm DB..status Unread & Read |
|
|
|
|
|
|
|
hmm..kalo nak buat pakai ape yee?
yg ni aku amik cth dr blogspot..
so nanti bile kite add another tu dier akan kuar textfield..ikut brape byk yg kite nak la..pastu save dlm db...cane ye? |
|
|
|
|
|
|
| |
|