I'm doing this for school, but am currently stuck with trying to get the array to echo the car in the budget range, but i cant figure out how to do it
so what ive tried doing so far is;
if ((isset($_POST["one"])) && (!empty($_POST["one"]))) {
$hi = $_POST["one"];
$arrayName = array('2018 Ford Mustang', '2019 Honda Civic Sedan VTi-L', 'Mazda RX-7', '2018 Honda NSX', 'Jeep Cherokee', 'Jeep Grand Cherokee', '2018 Ford Focus', '2018 Ford Fiesta', 'Nissan patrol ST');
$arrayprice = array('40000', '31795', '50000', '380000', '44000', '54990', '34490', '20525', '19990');
foreach ($arrayprice as $key => $value)
{
switch ($arrayprice)
{
case $hi >= $value: echo "<p>".$arrayName[$key]."</p>"; break;
case $hi <= '20000' && $hi >= '30000': echo $arrayName["0"];
and the same thing, but instead of the zero i had [$key] '0'
if ((isset($_POST["one"])) && (!empty($_POST["one"]))) {
$hi = $_POST["one"];
$arrayName = array('2018 Ford Mustang', '2019 Honda Civic Sedan VTi-L', 'Mazda RX-7', '2018 Honda NSX', 'Jeep Cherokee', 'Jeep Grand Cherokee', '2018 Ford Focus', '2018 Ford Fiesta', 'Nissan patrol ST');
$arrayprice = array('40000', '31795', '50000', '380000', '44000', '54990', '34490', '20525', '19990');
foreach ($arrayprice as $key => $value)
{
switch ($arrayprice)
{
case $hi >= $value: echo "<p>".$arrayName[$key]."</p>"; break;
case $hi <= '20000' && $hi >= '30000': echo $arrayName[$key]'0';
i want it to output the array index that I put in as the car in that budget range. for example if the budget range is between 20000 and 30000 then it should output the ford fiesta, whereas, if the budget is between 10000 and 20000 it should output the nissan patrol st.
(I'm new to programming and all that and just asking for a friend, sorry if you can't understand what I'm trying to say or explain)