<?php require_once('includes/cmain.inc.php'); ?> 
<?php 
$url = explode('/', rtrim($_SERVER["REQUEST_URI"],"/"));

$count=count($url);
$menuurl = $url[$count-1]; 
if($menuurl=='contact-us'){include('contact-us.php');exit;}
if($menuurl=="thank-you"){include('thank-you.php');exit;}
if($menuurl=="lead-submit"){include('lead-submit.php');exit;}
if($menuurl=="thanks"){include('thanks.php');exit;}
if($menuurl=="book-meeting"){include('book-meeting.php');exit;}
$menuurl = ucwords(str_replace('-', ' ',$url[$count-1]));
//print_r("select * from tbl_metal where `country_url`='".strtolower($menuurl)."' and country_status=1");exit();
$sqls=db_query("select * from tbl_metal where `country_url`='".strtolower($menuurl)."' and country_status=1");	
$ress=mysqli_fetch_array($sqls);
$newq =$ress['country_url'] ?? '';//print_r($newq);exit();
//print_r($ress['category']);exit();
if(!empty($newq)){include('metal-components-test.php');exit;}

$sqlsI=db_query("select * from tbl_industry_served where `country_url`='".strtolower($menuurl)."' and country_status=1");	
$ressI=mysqli_fetch_array($sqlsI);
$newI =$ressI['country_url'] ?? '';//print_r($newq);exit();
//print_r($ress['category']);exit();
if(!empty($newI)){include('industries-served.php');exit;}

$sqlmenu=db_query("SELECT * FROM `the_menu`  where name='".trim($menuurl)."' and status=1");
$menu=mysqli_fetch_array($sqlmenu);
$menuother= $menu['name'] ?? '';
if($menuurl==$menuother){include('info.php');exit;}
?>
<?php
$qs1=explode("=",$_SERVER['REDIRECT_QUERY_STRING']);
//print_r($_SERVER["REQUEST_URI"]);exit();
$countryName=str_replace("-"," ",$qs1[1]);
$ext=$qs1[2] ?? '';
$a=SITE_WS_PATH .'/'.$qs1[1];
$location_replace = ucwords(stripslashes($countryName));
$banner_match = ucwords(stripslashes($countryName));
$services_replace = ucwords(stripslashes($countryName));
$sqls=db_query("select * from tbl_country where `country_url` LIKE '".$countryName."' and country_status=1");	
$ress=mysqli_fetch_array($sqls);
$newq =$ress['country_url'] ?? ''; 
if($newq == NULL)
{
include('404page.php');exit;
}
else
{
$meta_title =str_replace("LOCATION_REPLACE", '', $ress['title']);
$meta_description =str_replace("LOCATION_REPLACE", '', $ress['description']);
$meta_keyword =str_replace("LOCATION_REPLACE", '', $ress['keyword']);
$meta_url=$a;
}
?>
<?php include('header.php'); ?>

<?php include('index_banner.php'); ?>

<!-- Welcome sec -->
<div class="welcome-sec">
<div class="container cf">
<div class="welcome-img">
<?// include('right_menu.php'); ?>
</div>

<!--<h1>--><?
/*if($ress['country_title']){ echo $ress['country_title']; }
else{ echo ucwords(stripslashes($countryName)); }	*/				 
?><!--<h1>-->
<div>
	<ul class="breadcrumb">
		<li><a href="<?php echo SITE_WS_PATH; ?>">Home</a></li>
		<li><?php echo ucwords(str_replace('-',' ',$segments[1])); ?></li>
	</ul>
</div>
<?php  $location_replace = '<b>'.ucwords(stripslashes($countryName)).'</b> ';
 $desc = stripslashes($ress['country_descriptions']);
echo str_replace("LOCATION_REPLACE", '', $desc);
?> 
<hr>
<?php
    // Loop through your FAQ data to display questions and answers
if (!empty($faqData)) {
    echo '<p style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 25px; text-align: center;"><b><u>FAQ</u></b></p>'; // Apply font family and size to the <p> element
    echo "<dl></dl>";
    echo '<dl style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 16px; text-align: left;">'; // Apply font family, size, and alignment to the <dl> element
    $i = 1;
    foreach ($faqData as $entry) {
        echo '<dt style="font-size: 18px;margin-bottom: 10px">'.'Q'.$i++.'. '  .$entry['name'] . '</dt>'; // Apply font size and alignment to the <dt> element
        echo '<dd style="font-size: 16px;margin-bottom: 20px;">' . $entry['acceptedAnswer']['text'] . '</dd>'; // Apply font size and alignment to the <dd> element
    }
    echo '</dl>';
}
    /*else {
        echo '<p>No FAQs available at the moment.</p>';
    }*/
    

?>


<ul id="doublelink">
<?php 
$qName=explode("=",$_SERVER['REDIRECT_QUERY_STRING']);
$name=ucwords(str_replace('-',' ',$qName[1]));
//echo "<pre>"; print_r($qName); echo "</pre>";
$sql=db_query("select * from tbl_related_link where country_id=(select country_id from tbl_country where country_url='".trim($name)."')");
while($res=mysqli_fetch_array($sql))
{
$res['link_name'];
$qName5=explode("/",$res['link_name']);
//echo "<pre>"; print_r($qName5); echo "</pre>";
/*$link1=strtolower(str_replace(' ','-',$qName5[1]));$link2=strtolower(str_replace(' ','-',$qName5[2]));$link3=strtolower(str_replace(' ','-',$qName5[3]));
$link4=strtolower(str_replace(' ','-',$qName5[4]));$link5=strtolower(str_replace(' ','-',$qName5[5]));$link6=strtolower(str_replace(' ','-',$qName5[6]));
$link7=strtolower(str_replace(' ','-',$qName5[7]));$link8=strtolower(str_replace(' ','-',$qName5[8]));$link9=strtolower(str_replace(' ','-',$qName5[9]));
$link10=strtolower(str_replace(' ','-',$qName5[10]));$link11=strtolower(str_replace(' ','-',$qName5[11]));$link12=strtolower(str_replace(' ','-',$qName5[12]));
$link12=strtolower(str_replace(' ','-',$qName5[14]));$link12=strtolower(str_replace(' ','-',$qName5[15]));$link12=strtolower(str_replace(' ','-',$qName5[16]));
$link12=strtolower(str_replace(' ','-',$qName5[17]));$link12=strtolower(str_replace(' ','-',$qName5[18]));$link12=strtolower(str_replace(' ','-',$qName5[19]));
$link12=strtolower(str_replace(' ','-',$qName5[20]));$link12=strtolower(str_replace(' ','-',$qName5[21]));$link12=strtolower(str_replace(' ','-',$qName5[22]));
$link12=strtolower(str_replace(' ','-',$qName5[23]));$link12=strtolower(str_replace(' ','-',$qName5[24]));$link12=strtolower(str_replace(' ','-',$qName5[25]));*/
$sqserv=db_query("select * from tbl_country where country_name='".$qName5[1]."' and parent_childs !='0'"); $req=mysqli_fetch_array($sqserv); $link1url=isset($req['country_url']) ? strtolower(str_replace(' ', '-', $req['country_url'])) : '';
$sqserv1=db_query("select * from tbl_country where country_name='".$qName5[2]."' and parent_childs !='0'"); $req1=mysqli_fetch_array($sqserv1); $link2url=isset($req1['country_url']) ? strtolower(str_replace(' ', '-', $req1['country_url'])) : '';
$sqserv2=db_query("select * from tbl_country where country_name='".$qName5[3]."' and parent_childs !='0'"); $req2=mysqli_fetch_array($sqserv2); $link3url=isset($req2['country_url']) ? strtolower(str_replace(' ', '-', $req2['country_url'])) : '';
$sqserv3=db_query("select * from tbl_country where country_name='".$qName5[4]."' and parent_childs !='0'"); $req3=mysqli_fetch_array($sqserv3); $link4url=isset($req3['country_url']) ? strtolower(str_replace(' ', '-', $req3['country_url'])) : '';
$sqserv4=db_query("select * from tbl_country where country_name='".$qName5[5]."' and parent_childs !='0'"); $req4=mysqli_fetch_array($sqserv4); $link5url=isset($req4['country_url']) ? strtolower(str_replace(' ', '-', $req4['country_url'])) : '';
$sqserv5=db_query("select * from tbl_country where country_name='".$qName5[6]."' and parent_childs !='0'"); $req5=mysqli_fetch_array($sqserv5); $link6url=isset($req5['country_url']) ? strtolower(str_replace(' ', '-', $req5['country_url'])) : '';
$sqserv6=db_query("select * from tbl_country where country_name='".$qName5[7]."' and parent_childs !='0'"); $req6=mysqli_fetch_array($sqserv6); $link7url=isset($req6['country_url']) ? strtolower(str_replace(' ', '-', $req6['country_url'])) : '';
$sqserv7=db_query("select * from tbl_country where country_name='".$qName5[8]."' and parent_childs !='0'"); $req7=mysqli_fetch_array($sqserv7); $link8url=isset($req7['country_url']) ? strtolower(str_replace(' ', '-', $req7['country_url'])) : '';
$sqserv8=db_query("select * from tbl_country where country_name='".$qName5[9]."' and parent_childs !='0'"); $req8=mysqli_fetch_array($sqserv8); $link9url=isset($req8['country_url']) ? strtolower(str_replace(' ', '-', $req8['country_url'])) : '';
$sqserv9=db_query("select * from tbl_country where country_name='".$qName5[10]."' and parent_childs !='0'"); $req9=mysqli_fetch_array($sqserv9); $link10url=isset($req9['country_url']) ? strtolower(str_replace(' ', '-', $req9['country_url'])) : '';
$sqserv10=db_query("select * from tbl_country where country_name='".$qName5[11]."' and parent_childs !='0'"); $req10=mysqli_fetch_array($sqserv10); $link11url=isset($req10['country_url']) ? strtolower(str_replace(' ', '-', $req10['country_url'])) : '';
$sqserv11=db_query("select * from tbl_country where country_name='".$qName5[12]."' and parent_childs !='0'"); $req11=mysqli_fetch_array($sqserv11); $link12url=isset($req11['country_url']) ? strtolower(str_replace(' ', '-', $req11['country_url'])) : '';
$sqserv12=db_query("select * from tbl_country where country_name='".$qName5[13]."' and parent_childs !='0'"); $req12=mysqli_fetch_array($sqserv12); $link13url=isset($req12['country_url']) ? strtolower(str_replace(' ', '-', $req12['country_url'])) : '';
$sqserv13=db_query("select * from tbl_country where country_name='".$qName5[14]."' and parent_childs !='0'"); $req13=mysqli_fetch_array($sqserv13); $link14url=isset($req13['country_url']) ? strtolower(str_replace(' ', '-', $req13['country_url'])) : '';
$sqserv14=db_query("select * from tbl_country where country_name='".$qName5[15]."' and parent_childs !='0'"); $req14=mysqli_fetch_array($sqserv14); $link15url=isset($req14['country_url']) ? strtolower(str_replace(' ', '-', $req14['country_url'])) : '';
$sqserv15=db_query("select * from tbl_country where country_name='".$qName5[16]."' and parent_childs !='0'"); $req15=mysqli_fetch_array($sqserv15); $link16url=isset($req15['country_url']) ? strtolower(str_replace(' ', '-', $req15['country_url'])) : '';
$links = [];
for ($i = 17; $i <= 25; $i++) {
    if (isset($qName5[$i])) {
        $countryName = $qName5[$i];
        $result = db_query("SELECT * FROM tbl_country WHERE country_name='$countryName' AND parent_childs !='0'");
        $row = mysqli_fetch_array($result);
        $links[$i] = isset($row['country_url']) ? strtolower(str_replace(' ', '-', $row['country_url'])) : '';
    } else {
        $links[$i] = ''; // optional: keep index with empty string
    }
}?>
<?php 
$link17url= !empty($link17url) ? $link17url : ' ';
$link18url= !empty($link18url) ? $link18url : ' ';
$link19url= !empty($link19url) ? $link19url  : ' ';
$link20url= !empty($link20url) ?  $link20url: ' ';
$link21url= !empty($link21url) ? $link21url : ' ';
$link22url= !empty($link22url) ? $link22url : ' ';
$link23url= !empty($link23url) ? $link23url : ' ';
$link24url= !empty($link24url) ?  $link24url: ' ';
$link25url= !empty($link25url) ?  $link25url: ' ';




?>
<li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link1url; ?>" ><?php echo $qName5[1]; ?></a> </li><li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link2url; ?>" ><?php echo $qName5[2]; ?></a> </li>
<li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link3url; ?>" ><?php echo $qName5[3]; ?></a> </li><li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link4url; ?>" ><?php echo $qName5[4]; ?></a> </li>
<li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link5url; ?>" ><?php echo $qName5[5]; ?></a> </li><li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link6url; ?>" ><?php echo $qName5[6]; ?></a> </li>
<li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link7url; ?>" ><?php echo $qName5[7]; ?></a> </li><li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link8url; ?>" ><?php echo $qName5[8]; ?></a> </li>
<li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link9url; ?>" ><?php echo $qName5[9]; ?></a> </li><li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link10url; ?>" ><?php echo $qName5[10]; ?></a> </li>
<li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link11url; ?>" ><?php echo $qName5[11]; ?></a> </li><li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link12url; ?>" ><?php echo $qName5[12]; ?></a> </li>
<li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link13url; ?>" ><?php echo $qName5[13]; ?></a> </li><li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link14url; ?>" ><?php echo $qName5[14]; ?></a> </li>
<li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link15url; ?>" ><?php echo $qName5[15]; ?></a> </li><li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link16url; ?>" ><?php echo $qName5[16]; ?></a> </li>
<li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link17url; ?>" ><?php echo $qName5[17] ?? ''; ?></a> </li><li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link18url; ?>" ><?php echo $qName5[18] ?? ''; ?></a> </li>
<li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link19url; ?>" ><?php echo $qName5[19]?? ''; ?></a> </li><li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link20url; ?>" ><?php echo $qName5[20] ?? ''; ?></a> </li>
<li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link21url; ?>" ><?php echo $qName5[21]?? ''; ?></a> </li><li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link22url; ?>" ><?php echo $qName5[22] ?? ''; ?></a> </li>
<li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link23url; ?>" ><?php echo $qName5[23] ?? ''; ?></a> </li><li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link24url; ?>" ><?php echo $qName5[24] ?? ''; ?></a> </li>
<li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$link25url; ?>" ><?php echo $qName5[25] ?? ''; ?></a> </li>
<?php }?>
</ul>
<style>
#doublelink li {line-height: 0.80;float: left;display: inline;width:24%;padding: 7px;text-align: left;}
#doublelink li a {width: 100%;font-size: 14px;color: #333333;}
</style>


<style>
#double ul {width: 100%; margin-bottom: 20px; overflow: hidden;}
#double li {line-height: 0.65;float: left;display: inline; width:22%;padding: 5px;text-align: left;}
#double1 li { line-height: 0.65; float: left; display: inline; width:33%; padding: 5px;text-align: left;}
#double li a { width: 100%; font-size: 12px; color: #333333;}
</style>

<h4 class="weserve">We serve across following Locations.</h4>

<ul id="double" style="width:80%;">
<?php $spCountry=str_replace(' ','-',trim(strtolower($countryName))); ?>

<?php  
$sql=db_query("select * from tbl_state where state_status='1' order by  state_name ASC ");

while($res=mysqli_fetch_array($sql))
{
$spState=str_replace(' ','-',trim(strtolower($res['state_name'])));
$id=$res['state_id'];

?>
<?php $spcity = isset($spcity) ? $spcity : '';
 ?>
<li class="emaujli"><a  href="<?php echo SITE_WS_PATH.'/'.$qName[1].'/'.trim($spcity).str_replace(' ','-',trim(strtolower($res['state_name']))); ?>" ><?php echo $res['state_name']; ?></a> <span class="listMobplus" > <i class="mshow fa fa-caret-down"></i></span>
<!--add div for county	-->
<div class="newdiv"  style="margin-top:5px">
<ul id="double">
<?php $spCountry=str_replace(' ','-',trim(strtolower($countryName)));  ?>
<?php  $sqlState = db_query("select county_name  from tbl_county where county_status='1' and state_id='$id' ");
while($resState = mysqli_fetch_assoc($sqlState)){ 
$valCounty = str_replace(' ','-',trim(strtolower($resState['county_name'])));
?>
<li style="margin-left:0px; width:25%;"><a href="<?php echo SITE_WS_PATH.'/'.$qName[1].'/'.str_replace(' ','-',trim(strtolower($res['state_name']))).'/'.trim($spcity).str_replace(' ','-',trim(strtolower($resState['county_name']))); ?>" ><?php echo $resState['county_name']; ?></a>
<?php }?> </li> </ul>
</div>   
<!--closed div for county	-->		
</li>
<?php }?>

<style>
.newdiv{display:none;position: absolute;width:64%;background: #fff;border-style: ridge;left: 90px;z-index: 9999;}
.emaujli:hover .newdiv{display:block;color:#000000;}
</style> 
</ul>
</div>
</div>
</main>
</div>
</div>
<?php include('footer.php'); ?>