CariDotMy

 Forgot password?
 Register

ADVERTISEMENT

View: 3821|Reply: 7

Function check integer dlm field

[Copy link]
Post time 17-1-2010 12:07 PM | Show all posts |Read mode
Salam semua,
Ali ada masalah macam mana nak pastikan  field integer ali ctnya field poskod, hanya nombor dibenarkan tok dimasukkan. sekiranya ali masukan abjad atau selain dr integer, akan pop up mesej kata, hanya iinteger dibenarkan.

terima kasih
Reply

Use magic Report


ADVERTISEMENT


Post time 17-1-2010 12:48 PM | Show all posts
Reply

Use magic Report

Post time 18-1-2010 03:47 AM | Show all posts
harness test() function in javascript
Reply

Use magic Report

 Author| Post time 18-1-2010 12:11 PM | Show all posts
Post Last Edit by alisetan at 18-1-2010 15:10

2# BorderManager

Lebih kurang lah bro,
kalau isi character dlm field integer,  bila dia nak klik butang "next" keluar mesej  "poskod mesti integer". so selagi tak betullkan , selagi tuh tak boleh pergi next page.

yang paling penting cam mana dia nak check input tuh mesti integer.
Reply

Use magic Report

Post time 18-1-2010 02:45 PM | Show all posts
4# alisetan

akak rasa ali nak wat data validation kot ni..
kalo betoi..
antara yg bole guna adalah is_int()..
ni akak bg contoh coding..
kalo nak kuarkan popup message..
kena guna java skit..

  1. <?php
  2. $poskod=12;
  3. //$poskod   = $_POST['poskod'];
  4. if (is_int($poskod)) {
  5. echo "baru betul integer!Bole klik next dah\n";?>
  6.   <INPUT TYPE="button" style="height: 25px; width: 100px" VALUE="NEXT" onClick="parent.location='http://www.google.com.my'"><br><br>
  7. <?} else {
  8.   echo "<INPUT TYPE='button' style='height: 25px; width: 100px' VALUE='NEXT' onClick='show_alert()'>";
  9. }
  10. ?>
  11. <html>
  12. <script type="text/javascript">
  13. function show_alert()
  14. {
  15. alert("poskod mesti integer beb!!");
  16. }
  17. </script>
  18. </html>
Copy the Code
Reply

Use magic Report

 Author| Post time 18-1-2010 03:32 PM | Show all posts
5# ana_una

thanks byk2 akak, dah berjaya
Reply

Use magic Report

Follow Us
Post time 19-1-2010 05:44 PM | Show all posts
6# alisetan

ur welkam bebeh..
Reply

Use magic Report

Post time 26-4-2010 10:53 AM | Show all posts
kan lebih baik kalo hanya allow user key-in integer 0-9 sahaja. tak perlu nk check lepas dia key-in, x perlu nk kuarkan alert message.
Reply

Use magic Report


ADVERTISEMENT


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

9-1-2025 05:30 AM GMT+8 , Processed in 0.048243 second(s), 21 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list