|  | 
	                
  
    | 
	 
        งานเข้า ไม่ทราบว่าส่วนที่เรากรอกเบอร์โทรจะให้กรอกได้แค่ตัวเลขต้องทำอย่างไรคะ     |  
    |  |  
 
	
		|  |  |  |  |  
		|  |  | 
          
            | <?php include("../Connections/connbanmai.php"); 
 if($Submit)
 {
 $select=mysql_query("select * from webboard_member where username='$username' ");
 $row=mysql_fetch_array($select);
 
 if($row[username]==$username){
 
 $text_error="<FONT SIZE='2' COLOR='#FF0000'>กรุณาป้อนชื่อผู้ใช้</FONT>";
 
 echo "<script language=\"javascript\">window.location='".basename($_SERVER['PHP_SELF'])."'</script>";
 }else{
 
 mysql_select_db($database_connbanmai,$connbanmai) or die("ไม่สามารถติดต่อฐานข้อมูลได้");
 $insert="insert into webboard_member (username,passwd,email,sex,data_member,tel) values ('$username','$passwd','$email','$sex','$data_member','$tel') ";
 $query=mysql_query($insert);
 }
 $select=mysql_query("select * from webboard_member order by id_member desc");
 $row=mysql_fetch_array($select);
 if($query==""){
 echo"<meta http-equiv='refresh'; content='0; url=member_success.php?id_member=$row[id_member]'>";}
 else{echo"ไม่สามารถบันทึกข้อมูลได้";}
 }
 ?>
 <meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
 <center>
 <div align="center"><img src="image/header/h_banmai.gif" width="800" height="150" /></div>
 <div align="center"><strong>สมัครสมาชิก</strong></div>
 <form name="form1" method="post" action="" enctype="multipart/form-data" onsubmit="return check(this)">
 
 <table width="800" border="0" cellpadding="0" cellspacing="0">
 <tr>
 <td><div align="right"><FONT SIZE="2">ชื่อผู้ใช้งาน</FONT><FONT SIZE="2" COLOR="">:</FONT></div></td>
 <td><div align="left">
 <input type="text" name="username" id="username" /> <FONT SIZE="1" COLOR="#FF0000">*  ชื่อผู้ใช้ต้องมากกว่า 6 หลัก</FONT><?php echo $text_error; ?>
 </div></td>
 </tr>
 <tr>
 <td><div align="right"><FONT SIZE="2">รหัสผ่าน</FONT></div></td>
 <td><div align="left">
 <input type="password" name="passwd" id="passwd" />
 <FONT SIZE="1" COLOR="#FF0000">*  รหัสผ่านต้องมากกว่า 6 หลัก </FONT>
 </div></td>
 </tr>
 <tr>
 <td><div align="right"><FONT SIZE="2" COLOR="">Email:</FONT></div></td>
 <td><div align="left">
 <input type="text" name="email" id="email" />
 <font color="#FF0000" size="1"> ตัวอย่าง [email protected] </font></div></td>
 </tr>
 <tr>
 <td><div align="right"><FONT SIZE="2">เพศ</FONT></div></td>
 <td><div align="left">
 <select name="sex" id="sex">
 <option value="???"><FONT SIZE="2" COLOR="">ชาย</FONT></option>
 <option value="???"><FONT SIZE="2" COLOR="">หญิง</FONT></option>
 </select>
 </div></td>
 </tr>
 <tr>
 <td><div align="right"><FONT SIZE="2">เบอร์โทรศัพท์</FONT><FONT SIZE="2" COLOR="">:</FONT></div></td>
 <td><div align="left">
 <input type="text" name="tel" id="?????????????"  onkeypress="checkvalue();"/>
 <font size="1" color="#FF0000">(ห้ามมีขีดขั้นและไม่เกิน 10 หลัก)  </font></div></td>
 </tr>
 <tr>
 <td valign="top"><div align="right"><FONT SIZE="2">ที่อยู่</FONT></div></td>
 <td><div align="left">
 <textarea name="data_member" id="data_member" cols="45" rows="5"></textarea>
 </div></td>
 </tr>
 <tr>
 <td> </td>
 <td><input type="submit" name="Submit" value="ตกลง" />
 <input type="reset" name="button2" id="button2" value="แก้ไข" /></td>
 </tr>
 <tr>
 <td> </td>
 <td><FONT SIZE="2" COLOR="#FF0000">เครื่องหมาย * ห้ามเว้นว่าง</FONT></td>
 </tr>
 </table>
 </form>
 <script language="javascript">
 function check(myfrm){
 if ( myfrm.username.value.length==0) {
 alert("กรุณาป้อนชื่อผู้ใช้");
 myfrm.username.focus();
 return false;
 }else if ( myfrm.passwd.value.length==0) {
 alert("กรุณาป้อนรหัสผ่าน");
 myfrm.passwd.focus();
 return false;
 }else if ( myfrm.username.value.length<6) {
 alert("ชื่อผู้ใช้ต้องมากกว่า 6 หลัก");
 myfrm.username.focus();
 return false;
 }else if ( myfrm.passwd.value.length<6) {
 alert("รหัสผ่านต้องมากกว่า 6 หลัก");
 myfrm.passwd.focus();
 return false;
 }else if ( myfrm.tel.value.length==0) {
 alert("กรุณาป้อนเบอร์โทรศัพท์");
 myfrm.tel.focus();
 return false;
 }else if ( myfrm.tel.value.length>10) {
 alert("เบอร์โทรศัพท์ต้องไม่เกิน 10 หลัก");
 myfrm.tel.focus();
 return false;
 
 }
 }
 </script>
 
 
 ไม่ทราบว่าส่วนที่เรากรอกเบอร์โทรจะให้กรอกได้แค่ตัวเลขต้องทำอย่างไรคะ  แล้วก็ส่วนกรอกอีเมลต้องให้กรอกในรูปแบบดังนี้อ่ะค่ะ  [email protected]  ไม่ทราบว่าจะทำอย่างไรดีคะ  งานต้องส่งก่อนเที่ยงอ่ะ  ตอนนี้เครียดมากมายค่ะ
 
 
 
 Tag : - - - -
 
 |  
            |  |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2009-08-28 10:21:00 | By :
                          gangzaclub | View :
                          1400 | Reply :
                          19 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |  
		|  |  |  |  |  
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code (PHP) 
 <?php
<script type="text/javascript">
function validate()
{
form_mail=document.form 
mail=form_mail.email.value.indexOf("@")
submitOK="True"
if (mail==-1) 
{
alert("รูปแบบอีเมลล์ไม่ถูกต้อง")
submitOK="False"
} 
if (submitOK=="False")
{
return false
}
}
</script>
<form name="form" method="post" action="test.php" onsubmit="return validate()">
E-mail  : <INPUT TYPE="text" NAME="email" size="26" style ="font-size:13pt;" >
</br>
</br>
<INPUT TYPE="submit" NAME="Submit" value="Submit"style ="font-size:13pt;">
<INPUT TYPE="reset" NAME="cancel"value="cancel"style ="font-size:13pt;">
?>
 
 
 
 เป็นjava script ตรวจสอบรูปแบบอีเมลล์ลองดูนะคะว่าได้หรือเปล่า
 
 
   
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 10:38:19 | By :
                            muay028 |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code (PHP) 
 <?php
<script>
function ck(evt)
{
var tel = true; //อนุญาตให้คีย์ตัวเลข
var k = event.keyCode;/* เช็คตัวเลข 0-9 */
if (k>=48 && k<=57) 
{ return tel; }
}
</script>
?>
 ไม่ได้เก่ง java ก๊าบ
 อีกแบบ ฟังช์ชันง่ายของ php เลย
 Code (PHP)
 
 <?php
if(! is_numeric($tel)){
echo "<script language='javascript'>alert('เบอร์เป็นตัวเลขเท่านั้น');history.back();</script> ";
exit();
}
?>
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 10:39:06 | By :
                            somparn |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ลืมอ่าน อีเมล์ด้วยแหะ ตัวอย่างของ No.1 ก็ได้นะคับ หรืออีกทางเลือก
 Code (PHP)
 
 <?php
<?
function check_email($email)
{	
//Check email
if(ereg("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]",$email))
	return true;
else
	return false;
}
?>
?>
 เรียกใช้งาน
 Code (PHP)
 
 <?php
if ( !check_email($email) ){
echo "<script language='javascript'>alert('รูปแบบอีเมล์ไม่ถูกต้องเด้อ');history.back();</script> ";
exit();
}
?>
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 10:42:20 | By :
                            somparn |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | var check = true; var value = tel.value;
 for(var i=0;i < tel.value.length; ++i)
 {
 var new_key = value.charAt(i);
 if(((new_key < "0") || (new_key > "9")) &&
 !(new_key == ""))
 {
 
 alert("กรุณาป้อนเบอร์โทรศัพท์เป็นหมายเลขเท่านั้น");
 myfrm.tel.focus();
 return false;
 }
 }
 
 if ((document.myfrm.email.value.length < 9) || (document.myfrm.email.value.indexOf('@') == -1) || (document.myfrm.email.value.indexOf('.') == -1)){
 alert("กรุณากรอกรูปแบบอีเมลล์ให้ถูกต้องด้วยค่ะ");
 myfrm.email.focus();
 return false;
 }
 
 
 เอาไปใส่เพิ่มน่ะคับ สู้ๆๆๆ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 10:44:20 | By :
                            petch.it24 |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ไม่รู้ตอบช้าไปรึป่าว อิอิ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 10:45:15 | By :
                            petch.it24 |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | check e-mail 
 Code (PHP)
 
 <?php
<script language = "Javascript">
function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}
		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }
		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
 		 return true					
	}
function ValidateForm(){
	var emailID=document.frmSample.txtEmail
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
</script>
<form name="frmSample" method="post" action="#" onSubmit="return ValidateForm()">
                <p>Enter an Email Address : 
                  <input type="text" name="txtEmail">
                </p>
                <p> 
                  <input type="submit" name="Submit" value="Submit">
                </p>
              </form>
</BODY>
?>
 
 only numerical in text
 
 <input name="m_idcard" type="text" class="TextBox21" id="phone_no" maxlength="13" onkeypress='if (event.keyCode<48||event.keyCode>59) event.returnValue=false' />
 
 
 
 
 
 
 ไม่มีประโยชน์ไม่เป็นรัย แต่อยากตอบ จริงๆ ครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 10:57:49 | By :
                            Sek-Artdrinker |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | เอางั้นเลย ใหน ๆ ก็เล่นเรื่องอีเมล์
 
 ก็ลองขัดเกลากระหม่อมที functions ที่ป้องกันพวกโปรแกรมสูบเมล์ผ่านเว็บเพื่อไปส่งยาไวอากร้าให้เรา
 
 function showmail($email) {
 $email = trim($email);
 $words = array("." => " [dot] ", "_" => " [underscore] ", "+" => " plus ", "@" => " [at] ", "-" => " [dash] ");
 return str_replace(array_keys($words), array_values($words), $email);
 }
 
 วิธีใช้ก็แสนง่าย
 
 echo showmail("[email protected]");
 
 ลองดูดิ๊
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 12:16:21 | By :
                            deawx |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ส่งงานทันหรือเปล่านั้น เพ่เสกเค้าเป็นห่วงอยู่ 5555555  (แซวเล่น) 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 13:36:35 | By :
                            somparn |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              |  แวะมาดู 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 14:43:30 | By :
                            gummezaka |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | อาจารไปธุระ  พอดีค่ะ  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 15:23:43 | By :
                            gangzaclub |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณทุกๆๆคำตอบค่ะ  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 15:28:20 | By :
                            gangzaclub |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | วันนี้พี่ปลากิมหายไปไหนเอ่ย  น้องคิดถึงนะเนี่ย  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 20:17:30 | By :
                            gangzaclub |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code 
 วันนี้พี่ปลากิมหายไปไหนเอ่ย น้องคิดถึงนะเนี่ย อย่ากระนั้นเลยครับ พี่เสกค่อยช่วยอยู่ ร็อคแอนโรล
 
 เอาแบบบ้านๆ ละกัน
 <script language="javascript">
 function isEmail(obj){
 var regExp = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
 return regExp.test(obj.value);
 }
 
 function isDigits(obj){
 var regExp = /[0-9]$/;
 return regExp.test(obj.value);
 }
 function inputDigitsOnly(obj){
 if(!isDigits(obj)){
 obj.value = obj.value.substring(0, obj.value.length -1);
 }
 }
 
 function check(myfrm){
 if ( myfrm.username.value.length==0) {
 alert("กรุณาป้อนชื่อผู้ใช้");
 myfrm.username.focus();
 return false;
 }else if ( myfrm.passwd.value.length==0) {
 alert("กรุณาป้อนรหัสผ่าน");
 myfrm.passwd.focus();
 return false;
 }else if ( myfrm.username.value.length<6) {
 alert("ชื่อผู้ใช้ต้องมากกว่า 6 หลัก");
 myfrm.username.focus();
 return false;
 }else if ( myfrm.passwd.value.length<6) {
 alert("รหัสผ่านต้องมากกว่า 6 หลัก");
 myfrm.passwd.focus();
 return false;
 }else if ( myfrm.tel.value.length==0 || !isDigits(myfrm.tel)) {
 alert("กรุณาป้อนเบอร์โทรศัพท์ให้ถูกต้อง");
 myfrm.tel.focus();
 return false;
 }else if (!isEmail(myfrm.email)) {
 alert("กรุณาป้อนอีเมลล์ให้ถูกต้อง");
 myfrm.tel.focus();
 return false;
 //Comment ไว้ไม่ต้องใช้หรอก ใส่ length ไปแล้ว
 //}else if ( myfrm.tel.value.length>10) {
 //alert("เบอร์โทรศัพท์ต้องไม่เกิน 10 หลัก");
 //myfrm.tel.focus();
 //return false;
 }else{
 return true;
 }
 }
 </script>
 
 <input type="text" name="tel" id="tel" onkeyup="inputDigitsOnly(this);" length="10"/>
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 20:35:21 | By :
                            plakrim |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              |  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 21:38:08 | By :
                            gangzaclub |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              |  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 21:51:50 | By :
                            plakrim |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ใส่ไปก็ไม่ฟ้องครับผมใส่ length ไว้ใน textbox ดูดีๆ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 21:56:07 | By :
                            plakrim |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | แห๋ม ม่ายพูดดีก่าาาาาาาาาา  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2009-08-28 23:41:31 | By :
                            gummezaka |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  |  |