Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Renting Calculation Make Order Name Number of Movies Rented Here is my code, but I'm having trouble adding errors and text alerts. For example I

</p> <p>Renting Calculation</p> <p>

Make Order

Name

Number of Movies Rented

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

{

$name1=$_POST['userName'];

$price=10.00;

$numberOfMoives=$_POST['numOfMoive'];

if($numberOfMoives<=20)

{

if($numberOfMoives<=2)

$price+=$numberOfMoives*5.50;

else if($numberOfMoives<=4)

{

$price=10.00;

$price+=($numberOfMoives-2)*4.25;

}

else if($numberOfMoives<=7)

{

$price=10.00;

$price+=($numberOfMoives-4)*3.00;

}

else

{

$price=10.00;

$price+=($numberOfMoives-4)*2.00;

}

echo "

".$name1." your total rent is $".number_format($price, 2)."

";

$myfile = fopen("visitor.txt", "w");

fwrite($myfile, $name1);

fclose($myfile);

}

else

{

$message = "you cant not rent more then 20 movies.";

echo "";

}

}

?>

Here is my code, but I'm having trouble adding errors and text alerts. For example I need an error message saying the fields can't be left blank when type in the username and number of movies. Also I need an error message that says you can't type in decimals in the "number of movies" box. Could you please help me?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

Conduct a needs assessment. page 269

Answered: 1 week ago