|
salam..
saya ade problem cne nk guna option dan nk kira jumlah harga.
cth: pengguna blh pilih sama ada nk buat byrn penuh ataupon
bayar deposit...ni coding dia..
<select name="status" id="status" value="status">
<option>Sila Pilih</option>
<option value ='deposit'>Selesai Deposit</option>
<option value ='penuh'>Selesai Sepenuhnya</option>
</select>
pastu cthnya kalo dia pilih deposit..dia akan kira pembayaran deposit.bila klik pada
field bayar dan baki akan terus keluar jumlah harga.
<script>
function sen(form)//byr penuh
{
var Jumlah2 = form.Jumlah2.value;
var Bayar = form.Bayar.value;
var Bayar = (100*Jumlah2)/100;
form.Bayar.value = Bayar.toFixed(2);
var JumS = (Jumlah2-Bayar);
form.Baki.value = JumS.toFixed(2);
}
function sen(form1)//deposit
{
var Jumlah2 = form.Jumlah2.value;
var Bayar2 = form.Bayar2.value;
var Bayar2 = (Jumlah2*0.3)
form.Bayar2.value = Bayar2.toFixed(2);
var JumS = (Jumlah2-Bayar2);
form.Baki2.value = JumS.toFixed(2);
}
</script>
<input name="Bayar" type="text" id="Bayar" readonly="readonly" onclick='sen(this.form)' />
<input name="Baki" type="text" id="Baki" readonly="readonly" onclick='sen(this.form)' />
dh pening dah~
*phew~ |
|
|
|
|
|
|
|
adeh aku xbaper pndai javascript.. |
|
|
|
|
|
|
|
huhu..saya kene cr alternative lain nie
|
|
|
|
|
|
|
|
nak tolong tapi tak berapa nk faham soalan... |
|
|
|
|
|
|
|
Originally posted by markisa at 10-5-2009 19:11
pastu cthnya kalo dia pilih deposit..dia akan kira pembayaran deposit.bila klik pada
field bayar dan baki akan terus keluar jumlah harga.
tak paham
cuba terang lebih detail skit.. |
|
|
|
|
|
|
|
dia nk kalo pilih drop down kuar terus harga kat bawah..
guna onselect rasanya.. |
|
|
|
|
|
|
|
Balas #6 budingyun\ catat
|
|
|
|
|
|
|
Balas #8 budingyun\ catat
nak tolong boleh..
tp tgk masa saya ..
lagi satu script tak lengkap..
susah nak baca.. |
|
|
|
|
|
|
|
salam nk tnye sape2 tau cara nk guna unlink in php.....
for delete file...sape ada cth coding....just using unlink.tlg paste sini. |
|
|
|
|
|
|
|
e.g delete image dlm folder images..
unlink("images/M406.jpg"); |
|
|
|
|
|
|
|
utk prob yg atas tu..
<select name="status" id="status" value="status" onchange="kiraharga(this.options[this.options.selectedIndex].value)>
<option>Sila Pilih</option>
<option value ='deposit'>Selesai Deposit</option>
<option value ='penuh'>Selesai Sepenuhnya</option>
</select>
kat js
function kiraharga(type)
{
if(type == 'Selesai Deposit')
{
var bayar = document.getElementbyId('Bayar')
var baki = document.getElementbyId('Baki')
var bayar_value = letak formula kat sini
var baki_value = letak formula kat sini
bayar.value = bayar_value
baki.value = baki_value
}else{
ikut cam contoh kat atas
}
} |
|
|
|
|
|
|
|
Post Last Edit by tokma at 1-9-2009 12:58
salam..camner nk baiki koding aku ni...bile upload file yang dah ade dia akan kuar echo "file sudah wujud";
if($Tambah=="Tambah")
{
if ($_FILES['file1']['type'] == "application/vnd.ms-powerpoint" OR $_FILES['file1']['type'] == "application/pdf" OR $_FILES['file1']['type'] == "application/msword" OR $_FILES['file1']['type'] == "text/plain" OR $_FILES['file1']['type'] == "image/pjpeg" OR $_FILES['file1']['type'] == "image/gif" OR $_FILES['file1']['type'] == "image/x-png" OR $_FILES['file1']['type'] == "image/bmp" OR $_FILES['file1']['type'] == "image/jpeg" OR $_FILES['file1']['type'] == "image/png")
{
if($_FILES['file1']['name'] == $file){
$file = $_FILES['file1']['name'];
//copy
copy ($_FILES['file1']['tmp_name'], "upload/".$_FILES['file1']['name']) or die ("Could not copy");
$qsel="INSERT INTO memo_lampiran (id_memo, perkara, file) VALUES ('$id_memo', '$perkara', '$file')";
$resel=mysql_query($qsel);
$id=mysql_insert_id();
echo "DATA TELAH DI TAMBAH.....";
echo "<META HTTP-EQUIV=Refresh CONTENT=\"01; URL=editMemo.php?id=$id&id_memo=$id_memo\">";
}else{
echo "File telah wujud";
}
}
//echo "DATA TELAH DI TAMBAH.....";
//echo "<META HTTP-EQUIV=Refresh CONTENT=\"01; URL=editMemo.php?id=$id&id_memo=$id_memo\">";
}
if yang aku bold tu salah...nk declare camner ek...
kalu size blh plk....
contoh...
if($_FILES['file1']['size'] <= 500000){
:
:
}else{} |
|
|
|
|
|
|
|
$file tu refer kat ner yek? |
|
|
|
|
|
|
|
kalu saya tambah kat
{ $qSel="SELECT file FROM memo_lampiran ";
$read=mysql_query($qSel) or die(mysql_error());
$rowad=mysql_fetch_array($read);
$file=$rowad['file'];
if($_FILES['file1']['name'] == $file){
$file = $_FILES['file1']['name'];
//copy
copy ($_FILES['file1']['tmp_name'], "upload/".$_FILES['file1']['name']) or die ("Could not copy");
boleh x?
x pun ade x cth yang blh saya refer.... |
|
|
|
|
|
|
|
erm leh x letak query tu sebelum if($_FILES['file1']['name'] == $file){ ..
guna query camni boleh?
$filename= $_FILES['file1']['name'];
$s = "Select id_memo, file from `memo_lampiran` where file=$filename";
$q = mysql_query($s);
$t = mysql_num_rows($q);
while($row = mysql_fetch_row($q)):
$id_memo = $row[0];
$file= $row[1];
endwhile;
if($_FILES['file1']['name'] == $file){ .. |
|
|
|
|
|
|
|
luper nak tambah
if($_FILES['file1']['name'] == $file){
echo "File telah wujud";
} else {
sini baru letak copy file nyer coding
} |
|
|
|
|
|
|
|
$s = "Select id_memo, file from `memo_lampiran` where file=$filename";
$q = mysql_query($s);
$t = mysql_num_rows($q);
while($row = mysql_fetch_row($q)):
bukan ambik $t kan...?
x jadi pn lagi....data masih ditambah..... |
|
|
|
|
|
|
|
ble buat camni
if($_FILES['file1']['name'] == $file){
echo "File telah wujud";
} else {...
dia trus kuar File telah wujud,walaupun file x wjud lg.... |
|
|
|
|
|
|
|
0k dh jadi....sy buang mysql_num_rows,tukar jd mysql_fetch_array.....while pun sy x gune..
thanks fieory..... |
|
|
|
|
|
|
| |
|