Jump to content

684425

Members
  • Content Count

    25
  • Joined

  • Last visited

Community Reputation

0 Neutral

About 684425

  • Rank
    Member
  1. The code in attached file is not working for me. and i am failed to find any mistake. Anyone help me please. deletedept.php
  2. Plz check attached file. it does not give any error when letters are typed. new.html
  3. <input id="numb" type="number" /> <input type="submit" onclick="myFunction()" /> <p id="demo"></p> <script> function myFunction(){ var x = document.getElementById('numb').value; var regex=/^[1-9]+$/; if (x == ""){ document.getElementById('demo').innerHTML = "Input is Missing"; } else if (!x.match(regex)){ document.getElementById('demo').innerHTML = "Input Incorrect"; } else { document.getElementById('demo').innerHTML = "Input OK"; } } /* if (x == "") { document.getElementById('demo').innerHTML = "Input is Missing"; } else if (isNaN(x)) { document.getElementById('demo').innerHTML = "Input Incorrect"; } else { document.getElementById('demo').innerHTML = "Input OK"; } } */ </script> When input type is "text" it works fine. but when i change input type to "number" and then if i type letters or letters plus numbers. it says "input missing" How can i get correct output while using input type "number" ? Please guide. Thankyou.
  4. Explained by a friend. $i = $i++; // internally is more like $temp = $i++; // $temp = 2; $i=3 $i=$temp; // $i=2
  5. Actually the question was asked in a facebook group. and my answer there was... You ignored variable $p in second code and directly called an output of $i so it became $i = 2; $i++; for php. In your 1st code you are trying to do the same thing, but because of only one variable $i on both sides in 2nd line, php ignored #YOU and did it work. 1st code $i = 2; //declared an assigned a value. $i = $i++; //another declaration. ------------------------------------ 2nd code $i = 2; //declared an assigned a value. $i++; // direct increment. Still i was confused... Thanks dear for reply
  6. <?php $i = 2; $i = $i++; echo $i; ?> Output of above code is 2. <?php $i = 2; $p = $i++; echo $i; ?> Output of above code is 3. Why this difference? I mean how these codes are processed to give an output?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.