Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8383819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:15:40+00:00 2026-06-09T17:15:40+00:00

I am trying to print table only if user enters integer value( no string,

  • 0

I am trying to print table only if user enters integer value( no string, float etc) but this code is not working let me now what i am missing to get only integer values without using JAVASCRIPT at front end. Let me know if im missing some logic.

This is my php code (index.php) —

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>table Data</title>
</head>

<body>

<table width="29%" border="1">
<form name="mytableform" id="mytableform" action="mytabledata.php" method="POST">
  <tr>
    <td width="42%">Enter any munber :&nbsp;</td>
    <td width="58%"><input type="text" name="mynumber" id="mynumber" />&nbsp;</td>
  </tr>
  <tr>
    <td>Enter limit :&nbsp;</td>
    <td><input name="limit" type="text" id="limit" />&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2"><input type="submit" value="Submit" name="submit" />&nbsp;</td>
    </tr>
 </form> 
</table>

</body>
</html>

My mytabledata.php content file —

<?php

$number = $_POST['mynumber'];
$limit = $_POST['limit'];

//var_dump($number);
//var_dump($limit);

if( is_int($number) )
{
    for($i=1;$i<=$limit;$i++)
    {
    $p= $number * $i;
    echo $number." X ".$i." = "." ".$p.";";
    echo "<br />";
    }
}
else{
echo "Please check the type of data you are entering.";
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:15:41+00:00Added an answer on June 9, 2026 at 5:15 pm

    The value from your POST is type of string. To use it you can do this:

    $number = intval( $_POST['mynumber'] );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, I am trying to create a table to receive user inputs (UGC). This
I am having trouble trying to print a table from a webpage. When I
Im trying to print the realtime output based on user input for a search.
I'm trying to print a large string to alivepdf. I'm splitting the string by
I'm trying to print out a list of products on a page. This is
I am trying to print HTML with this JavaScript in the webview, however it
I am trying to print a particular text using awk if string is empty.
I'm trying to print a table with a lot of columns, so that the
Honestly, I'm not even sure the best way to go about this, but essentially,
Im trying print Excel file data on a page. To do it i used

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.