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

  • Im working with php but having problem displaying the correct result. I need to show Order...

    Im working with php but having problem displaying the correct result. I need to show Order processed at (time) HTML file: <!DOCTYPE html> <html> <head> <title>Bob's Auto Parts - Order Form</title> </head> <body> <form action="processorder.php" method="post"> <table style="border: 0px;"> <tr style="background: #cccccc;"> <td style="width: 150px; text-align: center;">Item</td> <td style="width: 15px; text-align: center;">Quantity</td> </tr> <tr> <td>Tires</td> <td><input type="text" name="tireqty" size="3" maxlength="3" /></td> </tr> <tr> <td>Oil</td> <td><input type="text" name="oilqty" size="3" maxlength="3" /></td> </tr> <tr> <td>Spark Plugs</td> <td><input type="text" name="sparkqty" size="3" maxlength="3" /></td>...

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

  • Write a PHP Script containing a function that calculates the tax (8%) on a purchase of...

    Write a PHP Script containing a function that calculates the tax (8%) on a purchase of $48.72. What I have so far. index.html <!DOCTYPE html> <html lang="en"> <head> <title>PHP Lab II</title> <meta charset="utf-8"> <link rel="stylesheet" href="main.css"> <meta name="robots" content="noindex, no follow, noarchive" /> <meta name="author" content="Michael Dimond Jr" /> </head> <body> <div id="wrapper"> <header> <h1>PHP Lab II</h1> </header> <main> <form action="display.php" method="post">    <div>        <label>Sale Total: </label>        <input type="text" name="sale_total"><br>        <br>    </div>   ...

  • I have created an HTML form. I need to connect this to a database to update...

    I have created an HTML form. I need to connect this to a database to update the phone number in the employee table HTML: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> </head> <body link="#0000EE" vlink="#551A8B" text="#000000" bgcolor="#566573" alink="#EE0000" background="../DOC/brushed-alum.png"> <form method="post" action="phonenumbers.php"> <h1>Update Employee Phone Number Form</h1> <br> <br> <h3>Enter the employee's ID number.</h3> <br> <br> Employee ID Number: <input name="EmployeeNumber" type="text"> <br> <br> <h3>Enter the new phone number</h3> Phone Number: <input name="OfficePhone" type="text">...

  • 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 with MySQL - Why do I get the following error and how do I...

    PHP Programming with MySQL - Why do I get the following error and how do I connect to my database. Looks like I might need to use mysqli instead of mysql but I dont know how to do that or what to change. I appreciate it is you fixed anything that needs to be re-written. Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /Applications/XAMPP/xamppfiles/htdocs/Week9/VerifyLogin.php:12 Stack trace: #0 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/Week9/VerifyLogin.php on line 12 Line 12: $DBConnect =...

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