Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 18.221.27.56
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/gmsnowman/www/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/gmsnowman/www/reviewInsert.php
<!-- Gabriella Snowman
	Final Project
	File: reviewInsert.php
	Input from users is inserted into REVIEW table
	-->

<HEAD>
<TITLE> Restaurant Review Table </TITLE>
</HEAD>

<BODY style="background-color:powderblue;"?

<?php
	$restName = $_POST['restName'];
	$atm = $_POST['atm'];
	$food = $_POST['food'];
	$price = $_POST['price'];
	$service = $_POST['service'];
	$speed = $_POST['speed'];

	$atmVal = 0;
	$foodVal = 0;
	$priceVal = 0;
	$serviceVal = 0;
	$speedVal = 0;

	$host = 'localhost';
	$user = 'gmsnowman';
	$passwd = 'cs389';
	$database = 'gmsnowman';
	$connect = mysqli_connect($host, $user, $passwd);


if ($atm == "Very Good")
{
        $atmVal = 5;
}
else if ($atm == "Good")
{
        $atmVal = 4;
}
else if ($atm == "Average")
{
        $atmVal = 3;
}
else if ($atm == "Poor")
{
        $atmVal = 2;
}
else
{
        $atmVal = 1;
}


if ($food == "Very Good")
{
	$foodVal = 5;
}
else if ($food == "Good")
{
	$foodVal = 4;
}
else if ($food == "Average")
{
	$foodVal = 3;
}
else if ($food == "Poor")
{
	$foodVal = 2;
}
else
{
	$foodVal = 1;
}


if ($price == "Very Good")
{
        $priceVal = 5;
}
else if ($price == "Good")
{
        $priceVal = 4;
}
else if ($price == "Average")
{
        $priceVal = 3;
}
else if ($price == "Poor")
{
        $priceVal = 2;
}
else
{
        $priceVal = 1;
}


if ($service == "Very Good")
{
        $serviceVal = 5;
}
else if ($service == "Good")
{
        $serviceVal = 4;
}
else if ($service == "Average")
{
        $serviceVal = 3;
}
else if ($service == "Poor")
{
        $serviceVal = 2;
}
else
{
        $serviceVal = 1;
}


if ($speed == "Very Good")
{
        $speedVal = 5;
}
else if ($speed == "Good")
{
        $speedVal = 4;
}
else if ($speed == "Average")
{
        $speedVal = 3;
}
else if ($speed == "Poor")
{
        $speedVal = 2;
}
else
{
        $speedVal = 1;
}


$overall = ($atmVal + $foodVal + $priceVal + $serviceVal + $speedVal)/5.0;

        $query = "insert into REVIEW values
                        ('$restName', '$atm', '$food', '$price', '$service', '$speed', $overall)";
        mysqli_select_db($connect, $database);


	if(mysqli_query($connect, $query))
	{
		include ("displayReview.php");
	}
	else
		print "<P> Insert fail.<P>";
	mysqli_close($connect);
?>

<HR>
<P>

Stv3n404 - 2023