Hello all,
I cant seem to pass one of the variables through for somereason.
This is a script containg 3 dropdown box. the country and the state dropdown box works but the city wont… cant seem to pass the country through to the next code.
<?php
require_once("C:\\wamp\\www\\servicebid\\inc\\connection.php");
[B]$country = $_GET['country']; // works.. tested[/B]
$provinceState_query = "SELECT DISTINCT province from tb_location where country = '$country'";
$result= mysqli_query($dbconnect, $provinceState_query) or die('<br/>Error reading Database:'.mysql_error());
?>
// problem area.. getcity isnt taking the country code
<[B]select name="state" onchange="getCity('<?=$country?>',this.value)">[/B]
<option>Select State</option>
<?php
while($row=mysqli_fetch_assoc($result))
{ echo '<option value="' . $row['province'] . '">' . $row['province'] . '</option>'; }
echo '</select>';
?>
This is the city dropdown box but the state variable is comming through but not the country… the country should come from the above code.
Any idea what im doing wrong?
<?php
require_once("C:\\wamp\\www\\servicebid\\inc\\connection.php");
$countryId = $_GET['country']; //not receiving the variable from the above code
$stateId = $_GET['state']; //works
echo '<br> ==>:1'.$countryId; // not pulling
echo '<br> ==>:2'.$stateId; // pulling
$city_query = "SELECT city from tb_location WHERE country ='$countryId' AND province='$stateId'";
$result= mysqli_query($dbconnect, $city_query) or die('<br/>Error reading Database:'.mysql_error());
while($row1=mysqli_fetch_assoc($result))
{ //testing
echo 'br>'.$row1['city'];
}
?>
<select name="city">
<option>Select City</option>
<?php
while($row=mysqli_fetch_assoc($result))
{ echo '<option value="' . $row['city'] . '">' . $row['city'] . '</option>'; }
?>
</select>
Someone else mentioned that yesterday, but from googling I can find nothing to support. Seems they will be around for ever. Personally I use “<?php echo” as “<?=” is server dependent (and PERDIR)
If I remember correctly <?= is going to be depreciated in php6 but <? will still remain. If you don’t want to have to worry about short tags compatibility then stick with <?php
According to my wifes cousins brothers friends dog, <?php is going to be deprecated in favour of <?php_hypertext_processor to clear up the naming confusion. You’d be surprised how many wrongly think it stands for post hyperspatial proxy.
Everyone is already confused enough about short tags, if you don’t know than don’t say. Particularly you orange guys