I am currently struggling with two dropdowns where the data from mysql fetches not correcly.
The first dropdown is a list of locations followed by the second dropdown that must show the dates available.
here is the code of the requested php:
<?php
require('base.php');
switch(@$_REQUEST['location']){
case 'RD':
$query = mysql_query("SELECT * FROM `courses` where location = 'Dubai'");
$row = mysql_fetch_array($query);
while($row = mysql_fetch_array($query))
{
$locdata = array_push($locdata, echo $row['day'].' '.$row['date'].' '.$row['month']);
}
break;
case 'UT':
$locdata=array( 'Monday 22 August', 'Tuesday 23 August');
break;
case 'NY':
$query = mysql_query("SELECT * FROM `cursussen` where locatie = 'New York'");
$row = mysql_fetch_array($query);
while($row = mysql_fetch_array($query))
{
$locdata = array_push($locdata, echo $row['dag'].' '.$row['datum'].' '.$row['maand']);
}
break;
case 'AM':
$query = mysql_query("SELECT * FROM `cursussen` where locatie = 'Amsterdam'");
$row = mysql_fetch_array($query);
while($row = mysql_fetch_array($query))
{
$locdata = array_push($locdata, echo $row['dag'].' '.$row['datum'].' '.$row['maand']);
}
break;
default:
$locdata=false;
}
if(!$locdata)echo 'Selecteer eerst een locatie';
else echo '<select name="locations"><option>'.join('</option> <option>',$locdata).'</select>';
If all cases is set manually like in case UT, it works perfectly. How can append the data obtained from the database into an array?