I am in the process of designing a php validated form for a restaurant website which directs the user to a thank you page, displaying their reservation details, once they have pressed submit. Currently I have 2 variables, one named 'party', the other named 'vip'. These variables both display a string value when echoed. However, I wish to assign them an int value and then add them together to display a total price to the user.
Currently I have this code which does not seem to function:
<b>Total Reservation Costs: </b> £
<?php
if ( $party == "1 Person (+£5)" )
{
$party = 5;
}
elseif if ( $party == "2 People (+£10)" )
{
$party = 10;
}
elseif if ( $party == "3 People (+£15)" )
{
$party = 15;
}
elseif if ( $party == "4 People (+£20)" )
{
$party = 20;
}
elseif if ( $party == "5 People (+£25)" )
{
$party = 25;
}
elseif if ( $party == "6 People (+£30)" )
{
$party = 30;
}
elseif if ( $party == "7 People (+£35)" )
{
$party = 35;
}
elseif if ( $party == "8 People (+£40)" )
{
$party = 40;
}
elseif if ( $party == "9 People (+£45)" )
{
$party = 45;
}
elseif if ( $party == "10+ People (+£50)" )
{
$party = 50;
}
if ( $vip == "Yes" )
{
$vip = 5;
}
elseif if ( $vip == "No" )
{
$vip = 0;
}
echo $party + $vip;
?>
If anyone knows how I can get this to work I would be very grateful, I am new to web languages so I apologise in advance if my answer isn't very clear. Thank you.
elseif ifI guess it works but it's not what you mean to write.