Internet Programming-php

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Internet Programming-php as PDF for free.

More details

  • Words: 568
  • Pages: 8
Question 1 "); print("PHP is neato.
"); print("4+8
"); print(4+8); print("
"); $total = 4+8; print("$total
"); ?> Compare the web browser view line by line with the PHP source code. Answer the following questions: 1) What does the PHP print statement do? 2) What is the difference between print("4+8") and print(4+8)?

View in http://localhost/xampp/lisa/lab_1.php

("4+8") (4+8)

Question 2 form.php This script demonstrates passing values within an array.

\n"; ?>

process.php This script demonstrates using values which were passed in an array.

\n"; $sum += $vals[$i]; } echo "

The sum of those three numbers is $sum.\n";

?>

The first PHP script should generate a form which allows the user to input 10 numbers. 1) When the forms submit button is pressed, the 10 numbers should be sent to the second PHP script as an array.

New coding for display 10 numbers

This script demonstrates passing values within an array.




"Tenth"); // This will ask user to enter tenth number

while (list($index, $name) = each($labels)) echo "$name number: 

\n"; ?>



View in http://localhost/xampp/lisa/form.php

2) The second script should display the sum in the array and the average of the 10 numbers. 3) The second script also display the largest number and the smallest number New coding for display the largest number and the average of the 10 numbers
This script demonstrates using values which were passed in an array.

$max) { $max = $vals[$i]; } if($vals[$i] < $min) { $min = $vals[$i]; } echo "Value $i: $vals[$i].
\n"; $sum += $vals[$i]; // calculate total sum $avg = $sum/10; // calculate average } // Display output echo "

The sum of those 10 numbers is $sum.\n"; echo "

The average of those 10 numbers is $avg.\n";

echo "

The largest of those 10 numbers is $max.\n"; echo "

The smallest of those 10 numbers is $min.\n"; ?>

View in http://localhost/xampp/lisa/process.php


Related Documents

Internet
May 2020 27
Internet
November 2019 56
Internet
May 2020 26
Internet
December 2019 54
Internet
November 2019 50
Internet
November 2019 52