Question

html/php 1. Create an html page (with an html file ending) that contains a form. This...

html/php

1. Create an html page (with an html file ending) that contains a form. This form will accept a number from the user. The form will then send this number to the assignment3.php program by using either GET or POST.

2. The assignment3.php program will read the value in the textbox and place it into the variable "myvalue". The program will then use either a switch statement or IF/THEN/ELSE statement to determine if the value entered is within 10 (below or above) the number 25. If it is, the message "You are good at guessing" will be displayed. If it is more than 10 (above or below) the message "You missed it, but please try again" will be displayed.

3. If the user guess 25 exactly, the program will use a loop (your choice of the type of loop) to display "You won!!" 25 times on the web page.

Homework Answers

Answer #1

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

This demonstration is using WAMP Server.

Here a new web page with name "assignment3.html" is created, which contains following code.

assignment3.html :

<!DOCTYPE html>

<html lang="en">

<head>

<!-- title for web page -->

<title>assignment3</title>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

</head>

<body>

<form action="assignment3.php" method="post">

Enter Number :

<input type="text" name="number"/>

<br><br>

<input type="submit" name="btnSubmit"/>

</form>

</body>

</html>

*******************************

assignment3.php

<?php

if(isset($_POST['btnSubmit']))

{

//number entered by user

$myvalue=$_POST['number'];

//checking $myvalue

if($myvalue <=10)

{

//display message

echo "You are good at guessing<br/>";

}

else if($myvalue==25)

{

//if $myvalue is exactly 25 then

//using for loop display

for($i=0;$i<25;$i++)

{

echo "You won!!<br/>";//print message

}

}

else if($myvalue >10)

{

//if $myvalue is greater than 10

//display message

echo "You missed it, but please try again<br/>";

}

}

?>

======================================================

Output : Open web page assignment3.html in the browser and will get the screen as shown below

Screen 1 :assignment3.html

Screen 2 :Screen when number is below 10

Screen 3 :Screen when number is equal to 25

Screen 4 :Screen when number is above 10

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.

Know the answer?
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
Similar Questions
For this assignment, create an html page that has a login form. The form should have...
For this assignment, create an html page that has a login form. The form should have 3 input elements -- 1. This should have a type text for the user to enter UserName 2. This should have a type password (like text except cannot see the text that is typed in), for the user to enter password. 3. Submit button (type submit, as we did in class on 2/6). The form method should be set to POST and the action...
You have one Question, Which have four parts, 1st... PHP scriptIn a HTML document, use PHP...
You have one Question, Which have four parts, 1st... PHP scriptIn a HTML document, use PHP to obtain the following :The user will write a sentence as a value of a predefined variable.The output should look like this :The sentence you entered is :This is my sentenceIt is composed of :• 4 different words• 19 characters (including spaces)Note : Your program should make sure the final output is in lower case with the first letter in upper case. 2nd... PHP...
Need this done using PHP code and not javascript Create a PHP form with a textarea...
Need this done using PHP code and not javascript Create a PHP form with a textarea field input and a submit button. The textarea field should be able to accept up to 250 characters. When the user clicks the Submit button, read the text in the textarea and display the following results on a web age. At the bottom of the page include a link back to the form. Number of characters: Number of words: (hint: explode the string into...
Create an application that will give valuable advice to future students from someone (you!) who is...
Create an application that will give valuable advice to future students from someone (you!) who is close to graduation. However, only end-users who have their credentials validated against the database (which uses encrypted passwords) are allowed entry. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- advice_ddl.sql CREATE DATABASE advice; USE advice; CREATE TABLE users ( id int primary key auto_increment, username varchar(255), password varchar(255) ); -- insert a row into the users table: -- username = foo -- password = bar INSERT INTO users (username, password) VALUES...
1) Create an interface to the keyboard (Scanner). Scanner is described in Chapter 2. 2) Prompt...
1) Create an interface to the keyboard (Scanner). Scanner is described in Chapter 2. 2) Prompt the user to enter their first and last name.. 3) Read the name into a String. 4) Print a person greeting such as “Hello FirstName LastName”. Print the users name in the greeting. 5) Prompt the user to enter 2 integers. 6) Read the integers into 2 variables into your program. 7) Prompt the user to enter a math operation – one of +,-,*,/...
PHP calculator problem Create a calculator class that will add, subtract, multiply, and divide two numbers....
PHP calculator problem Create a calculator class that will add, subtract, multiply, and divide two numbers. It will have a method that will accept three arguments consisting of a string and two numbers example ("+", 4, 5) where the string is the operator and the numbers are what will be used in the calculation. It doesn't need an HTML form, all the arguments are put in through the method. The class must check for a correct operator (+,*,-,/), and a...
: YOU MUST USE SWITCH STATEMENTS TO SOLVE THE NEXT TWO PROBLEMS DO NOT USE LOOPS!...
: YOU MUST USE SWITCH STATEMENTS TO SOLVE THE NEXT TWO PROBLEMS DO NOT USE LOOPS! For this problem you must run the program to show all of your menu options working, just like with Problem 1, you will have a screen shot for every menu option and then you will have a screen shot for entering a value that is not part of the menu option. Write a program that displays the following menu to the user: Welcome to...
Description: The purpose of this assignment is to practice writing code that calls functions, and contains...
Description: The purpose of this assignment is to practice writing code that calls functions, and contains loops and branches. You will create a C program that prints a menu and takes user choices as input. The user will make choices regarding different "geometric shapes" that will be printed to the screen. General Comments: Your code must contain at least one of all of the following control types: nested for() loops a while() or a do-while() loop a switch() statement an...
Part A. Input Validation (Name your C program yourLastName_yourFirstName_Lab4a.c) 1. Place the code you developed in...
Part A. Input Validation (Name your C program yourLastName_yourFirstName_Lab4a.c) 1. Place the code you developed in Lab 2 to obtain a diameter value from the user and compute the volume of a sphere (we assumed that to be the shape of a balloon) in a new program, and implement the following restriction on the user’s input: the user should enter a value for the diameter which is at least 8 inches but not larger than 60 inches. Using an if-else...
complete a C++ program that asks the user to make a choice off a menu that...
complete a C++ program that asks the user to make a choice off a menu that will be displayed to them. The user can make as many selections as they wish. The last choice from the menu will give them an option to stop. The menu choices will be the following four calculations: Find the volume of a cone Find the volume of a sphere Find the area of octagon Find the distance between two points Stop For the different...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT