Jump to content

not echoing value??


dflow

Recommended Posts

im switching a dropdown

why is CountryName not echoing?i get an empty list

<?php require_once('Connections/tests.php'); ?>
<?php $CatID=intval($_GET['country']);
echo $CatID;
?>



<?php mysql_query("SET NAMES 'utf8'")?>
<?php

$dbconnection = mysql_connect ("localhost", "root", "") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("international", $dbconnection) or die("Couldn't open database: ".mysql_error());


if (isset($CatID)) {
    echo "This var is set so I will print.";
}
switch ($CatID)
{
    case 1:
$result = mysql_query("SELECT country_list.CountryName,country_list.CountryName_heb from country_list WHERE CategoryID = '".$_GET['CatID']."'");
        break;
    case 2:
        $result = mysql_query("SELECT country_list.CountryName,country_list.CountryName_heb from country_list WHERE CatID2 = '".$_GET['CatID']."'");
        break;
case 3:
        $result = mysql_query("SELECT country_list.CountryName,country_list.CountryName_heb from country_list WHERE CatID3 = '".$_GET['CatID']."'");
        break;
case 4:
        $result = mysql_query("SELECT country_list.CountryName,country_list.CountryName_heb from country_list WHERE CatID4 = '".$_GET['CatID']."'");
        break;
case 5:
        $result = mysql_query("SELECT country_list.CountryName,country_list.CountryName_heb from country_list WHERE CatID5 = '".$_GET['CatID']."'");
        break;
}   	
?>




<select name="state" onchange="getCity(<?php echo $CatID;?>,this.value)">
<option>Select State</option>
<?php while($row=mysql_fetch_array($result)) { ?>

<option value="<?php echo $CatID; ?>"><?php echo $row_result['CountryName']; ?></option>
<?php } ?>
</select>
<?php
mysql_free_result($result);
?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/185216-not-echoing-value/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.