Question

Create an HTML form that takes these inputs: Number of rows, and number of columns. This...

Create an HTML form that takes these inputs: Number of rows, and number of columns. This form will submit to a PHP page.

Create that page that will accept input from the HTML form and generates the table from the user's input.

I already have the portion that generates the table based on user input by using Javascript in an HTML page, I just need to know how to generate the table using a PHP page instead. Here's the code below:

____________________________________________________________________________________________________________________________________

<?xml version = "1.0"?>
<!DOCTYPE html PUBLIC "-//w3c//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns = "http://www.w3.org/1999/xhtml">
   <head>
     
   </head>

   <body>
      
      
       </br>
  
       <script type ="text/javascript">
       rn=prompt("How many rows?");
       cn=prompt("How many columns?");
       </script>

       <h2> Generated table below: </h2>

       <table id="thisTable" border="1" style="width:50%">
           <script type="text/javascript">
           for (var rows=0;rows<parseInt(rn,10);rows++){
           var x = document.getElementById('thisTable').insertRow(rows);
               for(var cols=0;cols<parseInt(cn,10);cols++){
               var y = x.insertCell(cols);
               y.innerHTML = "Row:"+rows+" Column:"+cols;
               }
          }
           </script>
       </table>
      

   </body>
</br></br>

</html>

____________________________________________________________________________________________________________________________________

0 0
Add a comment Improve this question Transcribed image text
Answer #1

HTML PAGE

<!DOCTYPE html>
<html>
<body>

<form method="post" action="action_page.php">
Enter number of Rows:<br>
<input type="number" name="row" >
<br>
Enter bumber of columns:<br>
<input type="number" name="col" >
<br><br>
<input type="submit" value="Submit">
</form>

<p>If you click the "Submit" button, the form-data will be sent to a page called "/action_page.php".</p>

</body>
</html>

PHP CODE

<?php //Refresh it everytime.
$Rows = $_POST['row']; //Dynamic number for Rowss
$Cols = $_POST['col']; // Dynamic number for Colsumns
echo "The Table is ";
echo '<table border="1">';
for($i=1;$i<=$Rows;$i++){ echo '<tr>';
for($j=1;$j<=$Cols;$j++){ echo '<td>' . mt_rand($i, $i*100) . mt_rand($j, $j*100) . '</td>'; }
echo '</tr>';
}
echo '</table>';
?>

OUTPUT

C localhost/HomeworkLib/one.html Enter number of Rows: Enter bumber of columns 4 Submit If you click the Submit button, the form-Clocalhost/HomeworkLib/action_page.php The Table is 557 91193 1031 72341 19722 6764 7219 35362 29078 2569 178118 4355

NOTE :- IAM generated the Random Numbers in The Table (In PHP Code)

THANK YOU!

Add a comment
Know the answer?
Add Answer to:
Create an HTML form that takes these inputs: Number of rows, and number of columns. This...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hello, I was wondering if someone could help me with this PHP and HTML problem. Basically,...

    Hello, I was wondering if someone could help me with this PHP and HTML problem. Basically, there is code for a multiplication table and i need to change it to support the following. Make the page background (not table background) to change among three colors of your choice. Use the drop-down list to specify the size of the multiplication table to be 8, 10, 12, and 14 Put the multipliers in the first column and the multiplicand on the first...

  • How can I connect the html forms to php --> mysql database <!DOCTYPE html> <html lang="en">...

    How can I connect the html forms to php --> mysql database <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <h2> <center> Average: </h2> <h3> <center> Rate the following: </h2> <h3> <center> Rating Criteria: <br> Developing (0-5), Competent (6-10), Accomplished (10-15); </h3> <center> Judge Name: <input type="text" id="judge"> <br> <br> <center> 1. Articulate requirements and design of the project: <input type="text" id="num1"> <br> <br> 2. Plan the solution and implement the project: <input type="text" id="num2"> <br> <br> 3....

  • Please I need help to create a website, using HTML5, that connects to Microsoft SQL Server...

    Please I need help to create a website, using HTML5, that connects to Microsoft SQL Server This what I came up with but I don’t know how to get it to connect to my server? Please help <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" > <head>     <title>Untitled Page</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>     <script>     $(document).ready(function(){         $("#Button1").click(function(){         var database = openDatabase($("#Text1").val(), "1.0", "Contact Manager", 200000);                  });       });     </script> </head> <body> <span>Enter DataBase Name: <input id="Text1" type="text" /></span> <span> <input...

  • 1. Predict the Result.Draw and write a brief description of the Web page that will becreated...

    1. Predict the Result.Draw and write a brief description of the Web page that will becreated with the following XHTML code:<!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" lang="en" xml:lang="en"><head><title>CircleSoft Designs</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style type="text/css">body { background-color: #FFFFCC;color: #330000;font-family Arial,Helvetica,sans-serif; }.content { width: 750px; }</style></head>Apply Your Knowledge<body><div class="content"><h1>CircleSoft Design</h1><div><strong>CircleSoft Designs will </strong><ul><li>work with you to create a Web presence that fits yourcompany</li><li>listen to you and answer your questions</li><li>utilize the most appropriate technology for your sites:JavaScript, Java, PHP, databases,...

  • Using form events functions to answer this question. Use the attached form html file which contains...

    Using form events functions to answer this question. Use the attached form html file which contains 2 html radio buttons. When the first choice is chosen, display the text ”First” under the first choice. When the second choice is chosen, display the text ”Second” under the second choice. Instead of using JavaScript complete this question using JQuery <!DOCTYPE html> <html> <head>     <title>midterm exam</title>     <link rel="stylesheet" href="css/q1.css" /> </head> <body>     <div id = "page">        <form>   ...

  • Hello please, don't use your handwriting in the solution Thank you In Page Layout Strategies, we ...

    Hello please, don't use your handwriting in the solution Thank you In Page Layout Strategies, we talked about fluid and fixed layouts. If I was given the below code. Does that fluid or fixed layouts, and how did you indicate that? Explain your answer <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>Mount Olympus News</title> <style type="text/css"> #wrapper {             width: 960px;             outline: #ff7900 2px dashed; } #main {             float: left;             width: 650px;             margin: 0 20px;            ...

  • Hello please, don't use your handwriting in the solution Thank you In Page Layout Strategies, we...

    Hello please, don't use your handwriting in the solution Thank you In Page Layout Strategies, we talked about fluid and fixed layouts. If I was given the below code. Does that fluid or fixed layouts, and how did you indicate that? Explain your answer <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>Mount Olympus News</title> <style type="text/css"> #wrapper {             width: 960px;             outline: #ff7900 2px dashed; } #main {             float: left;            ...

  • I am having an issue. When i press submit to test the code, it goes to...

    I am having an issue. When i press submit to test the code, it goes to a blank screen. Please, will some one assist me? Thanks! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Sign Guest Book</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php if (empty($_POST['?rst_name']) || empty($_POST['last_name']))     echo "<p>You must enter your ?rst and last name! Click your browser's Back button to return to the Guest Book form.</p>"; else {     $DBConnect = @mysql_connect("localhost", "root", "");    ...

  • PHP Can't get my code to work, what am I doing wrong? <!DOCTYPE html> <html> <head>...

    PHP Can't get my code to work, what am I doing wrong? <!DOCTYPE html> <html> <head> <script> </script> </head> <body> <h2>Temperature Conversion Table</h2> <h4>Enter a starting value in degrees Fahrenheit and an increment value.</h4> <form name="myTemp" onsubmit="convertCelcius()" method="post"> <input type="text" name="temperature"> Enter an value in degrees Fahrenheit<br><br> <input type="radio" name="degIncrement" id="degIncrement5"> Convert in increment in 5 degrees<br> <input type="radio" name="degIncrement" id="degIncrement10"> Convert in increment in 10 degrees <br/><br/><input type="submit" value="Submit"> </form> <?php if( $_POST["temperature"] || $_POST["degincrement"] ) { //get he...

  • Hello! I am to create a .js file that allows the paragraph on the bottom of...

    Hello! I am to create a .js file that allows the paragraph on the bottom of the page to update with what the user enters. I need to modify the given HTML to recognize the javascript file that I am to make from scratch. The HTML file and other details are below: Use the given HTML to add functionality to an interactive form that generates an invitation to volunteers for an event. The file will have the following invitation message...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT