Question

Create a PHP-backed webpage that ask for a number and calculate is square 10 times. Hint...

Create a PHP-backed webpage that ask for a number and calculate is square 10 times.

Hint 1:

<html>

<body>

<h1>Iteration Program</h1>

Today's date:

<?php echo date("1 F d, Y"); ?>

<h3>Enter a Value to Iterate</h3>

<form action="results.php",method=post>

<input type="text" name="data">

<p/>

<input type="submit" value="Show Results">

</form>

</body>

</html>

Hint 2:

<html>

<body>

<h1>Iteration Results</h1>

<b>Here are 10 iterations of the formula:<br/>

y=x<sup>2</sup>

</b>

<p/>

<!-- PHP Calculations start here! -->

<?php

$num = $_POST['data'];

//Write your code Here!

?>

</body>

</html>

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

index.php:

<html>
<body>
<h1>Iteration Program</h1>
Today's date:
<?php echo date("1 F d, Y"); ?>
<h3>Enter a Value to Iterate</h3>
<form action="results.php" method="post">
<input type="text" name="data" id="data">
<input type="submit" value="Show Results">
</form>
</body>
</html>

results.php:


<html>
<body>
<h1>Iteration Results</h1>
<b>Here are 10 iterations of the formula:<br/>
y=x<sup>2</sup>
</b>
<p/>

<?php
$num=$_POST["data"];
for($i=1;$i<=10;$i++)
{
   echo $num*$num;
   echo "<br>";
}
?>
</body>
</html>

Output:

Add a comment
Know the answer?
Add Answer to:
Create a PHP-backed webpage that ask for a number and calculate is square 10 times. Hint...
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
  • PHP - Use of classes This is a further development of the previous task, the participant...

    PHP - Use of classes This is a further development of the previous task, the participant registration. You must use the following Participant class. <?php class Deltaker { private $etterNavn; private $forNavn; private $fAar; function __construct(string $fornavn, string $etternavn, string $aar) { $this->forNavn = $fornavn; $this->etterNavn = $etternavn; $this->fAar = $aar; } function hentEtterNavn() : string { return $this->etterNavn; } function hentForNavn() : string { return $this->forNavn; } function hentFAar() : string{ return $this->fAar; } //Setters function settForNavn(string $fornavn) {...

  • PHP, HTML I have this code in the picture below for a guess game.

    PHP, HTML I have this code in the picture below for a guess game.

  • PHP code that is given : <?php // Here is where your preprocessing code goes //...

    PHP code that is given : <?php // Here is where your preprocessing code goes // An example is already given to you for the First Name $fname = $_GET['fname']; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Exercise 2 - GET Echo</title> <style> body { margin:0; padding:0; font-family: Arial; } form { margin:20px; } input[type="text"], input[type="password"] { width:150px; padding:3px; font-size:1em; } input[type="submit"] { padding:3px; font-size:1em; } label { display:inline-block; width:150px; } .input-container { padding:5px; } </style> </head> <body> <form...

  • 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...

  • Q1. rewrite the exercise on April 4 by adding the following operations: 1) In the php...

    Q1. rewrite the exercise on April 4 by adding the following operations: 1) In the php script, create an associative array named $order that stores the following values: - the number of cheese toppings; - the number of pepperoni toppings; - the number of ham toppings; - the size of the ordered pizza; - the number of the ordered pizza; - the total cost of the order; - the discount rate; - the total cost after the discount. 2) the...

  • LANGUAGE JAVASCRIPT, PHP Need help with PHP and ajax code. The user needs to login but,...

    LANGUAGE JAVASCRIPT, PHP Need help with PHP and ajax code. The user needs to login but, I keep getting an error that I coded "Wrong username and password!" ***PLEASE DONT GIVE ME A NEW CODE THAT IS NOWHERE NEAR THE CODE I SUBMITTED***** PLEASE LOOK AT THE CODE AND SEE ANY ISSUES login.html <!DOCTYPE html> <html> <head> <title>login popup</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <style type="text/css"> body { background-color: white; } </style> </head> <body> <center> <h1 style="text-align: center;"> Login </h1> <form>             Login ID:...

  • PHP Programming In this project, you will create a Web page that allows visitors to your...

    PHP Programming In this project, you will create a Web page that allows visitors to your site to sign a guest book that is saved to a database. Create a new document in your text editor and type the <!DOCTYPE> declaration, <html> element, document head, and <body> element. Use the strict DTD and “Guest Book” as the content of the <title> element. Add the following text and elements to the document body: <h2>Enter your name to sign our guest book</h2>...

  • <html> <!--This is the form for an instructor to upload a file having the grade of...

    <html> <!--This is the form for an instructor to upload a file having the grade of students in a class--> <body> <h2>Upload Student Grade</h2> <form action="1.php" method="POST" enctype="multipart/form-data">    Instructor's First Name:<input type="text" name="first"><br><br>    Instructor's Last Name: <input type="text" name="last"><br><br>      Instructor's Department Name:<input type="text" name="department"><br><br>          Upload student grade: <input type="file" name="image" /><br><br> <input type="submit"/> </form>    </body> </html> //***************************************************Q1****************************************************************************      /*(((( Q1)))). (18 points) Add the code below that *   uploads the file containing the students'...

  • Please write a PHP program and use the codes below to come up with the solution...

    Please write a PHP program and use the codes below to come up with the solution provided in the screen shot <!DOCTYPE html> <html> <head> <style> .error {color: #FF0000;} </style> <title> Lab 3 </title> </head> <body> <h1>Birthday Count Down</h1> <form method="post" action="/ITEC4450/Labs/Lab3/Lab3.php"> <p><span class="error">* required field.</span></p> Your name please: <input type="text" name="name" value = "" ><span class="error">* </span><br/><br/> Select the month of your birthday: <select name="month"> <option value="January" >January</option> <option value="February" >February</option> <option value="March" >March</option> <option value="April" >April</option> <option value="May"...

  • <!DOCTYPE html> <html> <head> <!-- JavaScript 6th Edition Chapter 4 Hands-on Project 4-3 Author: Da...

    <!DOCTYPE html> <html> <head> <!-- JavaScript 6th Edition Chapter 4 Hands-on Project 4-3 Author: Date:    Filename: index.htm --> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Hands-on Project 4-3</title> <link rel="stylesheet" href="styles.css" /> <script src="modernizr.custom.05819.js"></script> </head> <body> <header> <h1> Hands-on Project 4-3 </h1> </header> <article> <div id="results"> <p id="resultsExpl"></p> <ul> <li id="item1"></li> <li id="item2"></li> <li id="item3"></li> <li id="item4"></li> <li id="item5"></li> </ul> </div> <form> <fieldset> <label for="placeBox" id="placeLabel"> Type the name of a place, then click Submit: </label> <input type="text" id="placeBox"...

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