Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy iam not getting this number as integer in php
    primarykey
    data
    text
    <p>I am trying to print table only if user enters integer value( <code>no</code> string, float etc) but this code is not working let me now what i am missing to get only integer values without using <code>JAVASCRIPT</code> at front end. Let me know if im missing some logic.</p> <p>This is my php code (<strong>index.php</strong>) --</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;table Data&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;table width="29%" border="1"&gt; &lt;form name="mytableform" id="mytableform" action="mytabledata.php" method="POST"&gt; &lt;tr&gt; &lt;td width="42%"&gt;Enter any munber :&amp;nbsp;&lt;/td&gt; &lt;td width="58%"&gt;&lt;input type="text" name="mynumber" id="mynumber" /&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Enter limit :&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;input name="limit" type="text" id="limit" /&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="2"&gt;&lt;input type="submit" value="Submit" name="submit" /&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;/form&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>My <strong>mytabledata.php</strong> content file --</p> <pre><code>&lt;?php $number = $_POST['mynumber']; $limit = $_POST['limit']; //var_dump($number); //var_dump($limit); if( is_int($number) ) { for($i=1;$i&lt;=$limit;$i++) { $p= $number * $i; echo $number." X ".$i." = "." ".$p.";"; echo "&lt;br /&gt;"; } } else{ echo "Please check the type of data you are entering."; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload