0% found this document useful (0 votes)
18 views4 pages

Widget Order and Registration Forms

The document includes a series of PHP and HTML files created by Aditya Bansal for an assignment, featuring a widget order form, a conditional processing script, a registration form, and a reply page. The widget order form allows users to specify a quantity of widgets, calculates total cost with tax and potential discounts, and provides payment options. The registration form collects user information and displays a confirmation message upon submission.

Uploaded by

adityabansal522
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views4 pages

Widget Order and Registration Forms

The document includes a series of PHP and HTML files created by Aditya Bansal for an assignment, featuring a widget order form, a conditional processing script, a registration form, and a reply page. The widget order form allows users to specify a quantity of widgets, calculates total cost with tax and potential discounts, and provides payment options. The registration form collects user information and displays a confirmation message upon submission.

Uploaded by

adityabansal522
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

{conditionalform.

html}

<!--
Student Name: Aditya Bansal
Student Id: 0825487
Class: MIT439_004
Assignment: 3
Date: 31 January 2024
URL: [Link]
-->

<!DOCTYPE html>
<html>
<head>
<title>Html widget order form - by {Aditya Bansal}</title>
</head>
<body>
<h2>Widget Order Form</h2>
Our widgets cost $2,000.00 each.<br />
<form action="[Link]" method="post">
How many widgets would you like to order:
<input type="text" name="quantity" size="4"><br /><br />
<input type="submit" name="submit" value="submit!">
<input type="reset" name="reset" value="reset!">
</form>
</body>
</html>

{[Link]}

<!--
Student Name: Aditya Bansal
Student Id: 0825487
Class: MIT439_004
Assignment: 3
Date: 31 January 2024
URL: [Link]
-->

<!DOCTYPE html>
<html>
<head>
<title>[Link]</title>
</head>
<body>
<?php

$quantity = $_POST['quantity'];
$cost = 2000.00;
$discount = 100.00;
$tax = 0.13;

// Check if quantity is not empty


if (!empty($quantity)) {
// Increment tax rate
$tax++;

// Calculate total cost without discount


$totalcost = $cost * $quantity;

// Check for discount eligibility


if (($totalcost < 5000) and ($discount)) {
echo ("Your \$$discount discount will not be applied!<br />");
}

// Apply discount if total cost is greater than or equal to 5000


if ($totalcost >= 5000) {
$totalcost = $totalcost - $discount;
}

// Calculate total cost with tax


$totalcost = $totalcost * $tax;

// Calculate monthly payments


$payments = round($totalcost, 2) / 12;

// Display information to the user


echo ("<h2>The payment calculation program</h2>");
echo ("<h2>programmed by {Aditya Bansal}</h2>");
echo ("You requested to purchase $quantity widget(s) at \$$cost each.<br />");
echo ("The total with tax, minus any discount, comes to $");
echo ($totalcost);
echo (".<br />You may purchase the widget(s) in 12 monthly installments of $");
echo ($payments);
echo (" each.<br />");
} else {
// Display error message if quantity is empty
echo ("Please make sure that you have entered a quantity and then resubmit.");
}
?>
</body>
</html>
{[Link]}

<!--
Student Name: Aditya Bansal
Student Id: 0825487
Class: MIT439_004
Assignment: 3
Date: 31 January 2024
URL: [Link]
-->

<!DOCTYPE html>
<html>
<head><title>Register Form</title></head>
<body>
<h2>Welcome to the ABC Web Site</h2>
<h3> - programmed by Aditya Bansal - </h3>
<form action="[Link]" method="post">
<p>
Enter your name: <input type="text" name="username"><br />
You live in: <input type="text" name="region"><br /><br />
<input type="submit" name="SUBMIT" value="Submit">&nbsp;&nbsp;&nbsp;
<input type="reset" name="RESET" value="Clear"></p>
</form>
<p><br /><em>
<?php
echo "Date: " . date('F dS, Y');
?>
</em></p>
</body>
</html>

{[Link]}

<!--
Student Name: Aditya Bansal
Student Id: 0825487
Class: MIT439_004
Assignment: 3
Date: 31 January 2024
URL: [Link]
-->
<!DOCTYPE html>
<html><head><title>Process Registration Form</title></head>
<body><h2>ABC Web Site Registration Reply Page</h2>
<?php
$username = $_POST['username'];
$region = $_POST['region'];
if (empty($username)) {
echo "You did not enter a username.<br />";
echo "Please return to the form and re-enter your information";
} else {
echo "<h3>Your information has been processed.</h3>";
echo "Thank you $username<br />";
echo "From the lovely region of : $region";}
?>
</body>
</html>

You might also like