Question
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
Renting Calculation
Make Order
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started