title: Mobile number and message text checking
body: <p>First of all, m not so good at PHP and learning it, please help. </p>
  
  <p>I want to make a page where I accept only mobile number and text and send it to 'process.php' for process next step after the following check.</p>
  
  <p>A1- Mobile field contain only digits (no alphabet, no '+ or -', no 'comma'). If field contain any non-digit, alert "Only Numeric Values Allowed", delete the mobile field contain and focus on it again.</p>
  
  <p>A2- Mobile field only allow 10 digits (not less than equals to 10 or not more than equals to 10). If field contain less than or more than 10 digits, alert "Only 10 digits Allowed", delete the mobile field contain and focus on it again.</p>
  
  <p>A3- Mobile field's digits start with 7, 8 or 9 (no other starting digits like 0 to 6 allowed). If starting contain 0 to 6, alert "Only 7, 8 or 9 at start allowed", delete the mobile field contain and focus on it again.</p>
  
  <p>A4- If Mobile field remain blank, alert "Please enter mobile number".</p>
  
  <p>B1- Text field check only 160 character (less than 160 allow but more than 160 not allowed) and display real time 'character remain' field below text field.</p>
  
  <p>B2- If text field remain blank, alert "Please enter text massage".</p>
  
  <p>If all the 'A'- section (for mobile field) &amp; 'B'- section (for text massage field) validity check complete then mobile field and text massage field send their data to 'process.php' for process next step.</p>
  
  <p>I have worked on it long but still need more to do and arrange it properly. Please need help and Thank You in advance</p>
  
  <pre><code>&lt;script language="javascript" type="text/javascript"&gt;
  // &lt;![CDATA[
  function checkNum(x) {
      if (!(/^\d+\d{9}$/.test(x.value))) {
          alert("Only 10 Digits Numeric Values Allowed");
          x.focus();
          return false;
      }
      return true;
  }
  // ]]&gt;
  &lt;/script&gt;
  &lt;script type = "text/javascript" &gt;
  // &lt;![CDATA[
  $(window).load(function () {
      $("#tm_field").keyup(function () {
          el = $(this);
          if (el.val().length &gt;= 160) {
              el.val(el.val().substr(0, 160));
          } else {
              $("#charNum").text(160 - el.val().length);
          }
      });
  });
  // ]]&gt;
  &lt;/script&gt;
  &lt;/p&gt;
  &lt;p&gt;
      &lt;title&gt;Test Page&lt;/title&gt;
  &lt;/p&gt;
  &lt;p&gt;&lt;strong&gt;This Free SMS page is still under construction,&lt;/strong&gt;&lt;/p&gt;
  &lt;p&gt;&lt;strong&gt;M working on it &amp;amp; it will start soon ................&lt;/strong&gt;&lt;/p&gt;
  &lt;form action="process.php" method="post"&gt;
      &lt;table border="1" align="center"&gt;
          &lt;tbody&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;span data-mce-mark="1"&gt;&lt;span color="red" style="color: red;" data-mce-mark="1"&gt;*&lt;/span&gt; Mobile Number &lt;/span&gt;&lt;/td&gt;
                  &lt;td&gt;
                      &lt;p&gt;&lt;input type="text" name="NUM" id="mn_field" onchange="checkNum(this)" /&gt;&lt;/p&gt;
                      &lt;p&gt;&lt;small&gt; Please enter 10 digits mobile number, only.&lt;/small&gt;&lt;/p&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;span data-mce-mark="1"&gt;&lt;span color="red" style="color: red;" data-mce-mark="1"&gt;*&lt;/span&gt; Text Message &lt;/span&gt;&lt;/td&gt;
                  &lt;td align="center"&gt;&lt;textarea id="tm_field" rows="7" cols="25"&gt;&lt;/textarea&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td colspan="1" align="center"&gt;Character remain(s)&lt;/td&gt;
                  &lt;td id="charNum"&gt;160&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td colspan="2" align="center"&gt;&lt;input type="submit" value="Bye Bye SMS" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td colspan="2" bgcolor="#ffffcc" align="center"&gt;&lt;small&gt;&lt;span style="text-decoration: underline;" data-mce-mark="1"&gt;N.B.&lt;/span&gt;&lt;strong&gt; &lt;/strong&gt;:- A " &lt;span color="red" style="color: red;" data-mce-mark="1"&gt;*&lt;/span&gt; " indicates a field is required&lt;/small&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>