السلام عليكم ورحمة الله وبركاته
لدي كود شغال واريد تطوير بسيط به
الكود عند ادخال بيانات في البوكس
input
مثال
12345
يظهر لدينا
test: 12345
الى هنا جميل لاتوجد مشاكل
الان اريد التطوير في
اذا كان من بين الارقام اول رقم هو رقم 1 او كان حرف معين احدده
ان يظهر جمله اخر وفي مكان اخر
وفي id خاص
لاني حاولت لكن يكرر بنفس الجمله
ارجو الافاده
PHP CODE:كود HTML:<script type="text/javascript"> function showResult(str) { if (str.length==0) { document.getElementById("info_reg_birthday").innerHTML="<br /> "; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("info_reg_birthday").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_reg.php?q="+str,true); xmlhttp.send(); } </script> <form name='myForm'> <input onkeyup="showResult(this.value)" class="account_input" name="civil_id" dir=ltr maxlength="12" onKeyPress="return numbersonly(this, event)" /> <div id="info_reg_birthday" class="account_birthday"> <div id="info_reg_age" class="account_birthday"> </form>
كود PHP:
<?php
$q=$_GET["q"];
if ($q)
{
$response="test: $q";
$get= substr("$q", 0, -4);
if ($get == 1) {
echo "Number One here";
}
}
//output the response
echo $response;
?>


رد مع اقتباس
