Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C# and php Project 1 – [20 points] [5 points] Write an HTML document to create a

ID: 3686375 • Letter: C

Question

C# and php Project 1 – [20 points] [5 points] Write an HTML document to create a form with the following capabilities: a. A text box to collect the user’s name b. Four checkboxes, one each for the following items: i. Four 25-watt light bulbs for $2.39 ii. Eight 25-watt light bulbs for $4.29 iii. Four 25-watt long-life light bulbs for $3.95 iv. Eight 25-watt long-life light bulbs for $7.49 c. A collection of three radio buttons that are labeled as follows: i. Visa ii. Master Card iii. Discover [5 points] Write a PHP script that computes the sub total cost of the ordered light bulbs. Add 6.2 percent sales tax. Display the total price. [5 points] The program should save the order to the text file. (save: name, selections, subtotal, tax, total) [5 points] The program must inform the buyer of exactly what was ordered. (show your order on the HTML/PHP file) Project 2 – Work with String – [10 points] Write a PHP script named states. php that creates a variable $states with the value "Mississippi Alabama Texas Massachusetts Kansas". The script should perform the following tasks: 1. Search for a word in $states that ends in ”xas”. 2. Store this word in element 0 of an array named $statesArray. 3. Search for a word in $states that begins with k and ends in s. Perform a case-insensitive comparison. 4. Store this word in element 1 of $statesArray. 5. Search for a word in $states that begins with M and ends in s. 6. Store this element in element 2 of the array. 7. Search for a word in $states that ends in a. 8. Output the array $statesArray to the screen. Project 3 - [20 points] Create a PHP page that contains an array of at least 20 movie titles or book titles (your choice). The HTML page should have an input box for the user to enter a username and a title of a favorite movie or a book. After the user enters a username, the page should display a welcome message. The page should look something like this:

Explanation / Answer

Project-1:

<?xml version = "1.0" encoding = "utf-8"?>

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

<title> Light bulb Sales </title>

</head>

<body>

<!-- The next line gives the address of the CGI program -->

<form action = "http://www.cs.uccs.edu/cgi-bin/sebesta/e9_4.pl"

      method = "post">

<h2> Welcome to the Light bulb Sales Order Form </h2>

<!-- Text widget for customer's name -->

<p>

Buyer's Name:

<input type = "text" name = "name" size = "30" />

</p>

<!-- Table for bulb items -->

<table border = "border">

<!-- First, the column headings -->

    <tr>

        <th> Product Name </th>

        <th> Price </th>

        <th> Quantity </th>

    </tr>

<!-- Now, the table data entries -->

    <tr>

        <td> Four 100-watt regular bulbs </td>

        <td> $2.39 </td>

        <td> <input type = "text" name = "four100" size ="2" /> </td>

    </tr>

    <tr>

        <td> Eight 100-watt regular bulbs </td>

        <td> $4.29 </td>

        <td> <input type = "text" name = "eight100" size = "2" /> </td>

    </tr>

    <tr>

        <td> Four 100-watt long-life bulbs </td>

        <td> $3.95 </td>

        <td> <input type = "text" name = "fourll" size = "2" /> </td>

    </tr>

    <tr>

        <td> Eight 100-watt long-life bulbs </td>

        <td> $7.49 </td>

        <td> <input type = "text" name = "eightll" size = "2" /> </td>

    </tr>

</table>

<!-- The radio buttons for the payment method -->

<h3> Payment Method: </h3>

<p>

<input type = "radio" name = "payment" value = "visa"

       checked = "checked" /> Visa <br />

<input type = "radio" name = "payment" value = "mc" /> Master Card <br />

<input type = "radio" name = "payment" value = "discover" /> Discover <br />

<!-- The submit and reset buttons -->

<input type = "submit" value = "Submit Order" />

<input type = "reset" value = "Clear Order Form" />

</p>

</form>

</body>

</html>

Project-2:

<?php
$states
= "Mississippi  kqwederts   Alabama Texas Massachusetts Kansas"; //Read the given states
$statesA = explode(' ', $states); //search for a word in $states that ends in ”xas
$result1 = array1();//Store this word in element 0 of an array named $statesArray

$result2 = array2();

foreach($statesA as $state) {
    if(
preg_match('/^k.*s$/i', trim($state))) { //Search for a word in $states that begins with k and ends in s. Perform a case-insensitive comparison.
        $result1[1] = trim($state); //Store this word in element 1 of $statesArray.

if(preg_match('/^M.*s$/i', trim($state))) {//Search for a word in $states that begins with M and ends in s.

$result2[1] = trim($state);//Store this element in element 2 of the array.
    }
}

//show results
//print_r($results);

foreach($results as $val){ //Output the array $statesArray to the screen.
    echo $val.'<br />';
}

?>

Project-3:

//Writes input from user to movies.txt

<?php

    if (isset($_POST["submit"])) {

        $title = $_POST['movieTitle'];

        $rating = $_POST['movieRatings'];

        $plot = $_POST['plot'];

    $handle = fopen('movies.txt', 'a');

    $names_array = array("$title","$rating","$plot");

    $string = implode(';', $names_array);

    fwrite($handle, $string." ");         

    fclose($handle);

    }  

    ?>

//Reads line from movies.txt and adds it to a li, with movie title becoming a link

<?php

    $filename = 'movies.txt';

    $handle = fopen($filename, 'r');

    $datain = fread($handle, filesize($filename));

    $lines = explode (" ",trim($datain));

    foreach($lines as $line)

    {

        list($title,$rating,$plot) = explode(";",$line,3);

        echo '<li><a href="movies.php?title='.$title.'">'.$title.'</a><span>'.$rating.'</span></li>';

    }

    ?>//So far so good

//And now I want to read title name, and based on the

//title name find a specific line with rating and plot