CARI Infonet

 Forgot password?
 Register

ADVERTISEMENT

12Next
Return to list New
View: 3835|Reply: 24

php..tolongg

[Copy link]
Post time 10-5-2009 07:11 PM | Show all posts |Read mode
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~
Reply

Use magic Report


ADVERTISEMENT


Post time 11-5-2009 07:28 PM | Show all posts
adeh aku xbaper pndai javascript..
Reply

Use magic Report

 Author| Post time 11-5-2009 07:51 PM | Show all posts
huhu..saya kene cr alternative lain nie
Reply

Use magic Report

Post time 11-5-2009 10:05 PM | Show all posts
nak tolong tapi tak berapa nk faham soalan...
Reply

Use magic Report

Post time 13-5-2009 01:39 PM | Show all posts
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..
Reply

Use magic Report

Post time 13-5-2009 03:30 PM | Show all posts
dia nk kalo pilih drop down kuar terus harga kat bawah..

guna onselect rasanya..
Reply

Use magic Report

Follow Us
Post time 13-5-2009 04:26 PM | Show all posts

Balas #6 budingyun\ catat

try guna onchange
Reply

Use magic Report

Post time 13-5-2009 04:30 PM | Show all posts

Balas #7 ana_una\ catat

aku xpndai sgt js..

ko wat kan lacth utk dia..
Reply

Use magic Report


ADVERTISEMENT


Post time 13-5-2009 07:08 PM | Show all posts

Balas #8 budingyun\ catat

nak tolong boleh..
tp tgk masa saya ..
lagi satu script tak lengkap..
susah nak baca..
Reply

Use magic Report

Post time 27-8-2009 02:31 PM | Show all posts
salam nk tnye sape2 tau cara nk guna unlink in php.....
for delete file...sape ada cth coding....just using unlink.tlg paste sini.
Reply

Use magic Report

Post time 28-8-2009 01:58 PM | Show all posts
e.g delete image dlm folder images..
unlink("images/M406.jpg");
Reply

Use magic Report

Post time 28-8-2009 02:08 PM | Show all posts
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
}
}
Reply

Use magic Report

Post time 1-9-2009 12:55 PM | Show all posts
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{}
Reply

Use magic Report

Post time 1-9-2009 01:09 PM | Show all posts
$file tu refer kat ner yek?
Reply

Use magic Report

Post time 1-9-2009 01:18 PM | Show all posts
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....
Reply

Use magic Report

Post time 1-9-2009 01:33 PM | Show all posts
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){ ..
Reply

Use magic Report


ADVERTISEMENT


Post time 1-9-2009 01:35 PM | Show all posts
luper nak tambah

if($_FILES['file1']['name'] == $file){
echo "File telah wujud";
} else {
sini baru letak copy file nyer coding
}
Reply

Use magic Report

Post time 1-9-2009 01:49 PM | Show all posts
$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.....
Reply

Use magic Report

Post time 1-9-2009 02:01 PM | Show all posts
ble buat camni

if($_FILES['file1']['name'] == $file){
echo "File telah wujud";
} else {...

dia trus kuar File telah wujud,walaupun file x wjud lg....
Reply

Use magic Report

Post time 1-9-2009 02:21 PM | Show all posts
0k dh jadi....sy buang mysql_num_rows,tukar jd mysql_fetch_array.....while pun sy x gune..
thanks fieory.....
Reply

Use magic Report

12Next
Return to list New
You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

21-5-2024 06:52 PM GMT+8 , Processed in 0.490791 second(s), 46 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list