<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bilgisayar &#187; sehir</title>
	<atom:link href="https://www.bilgisayar.me/index.php/tag/sehir/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.bilgisayar.me</link>
	<description></description>
	<lastBuildDate>Wed, 29 Aug 2018 20:31:06 +0000</lastBuildDate>
	<language>tr-TR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.29</generator>
	<item>
		<title>Şehirler/ilçeler veritabanı, ve  seçenek menüsünü şehirlere göre, ilçeleri güncelleme</title>
		<link>https://www.bilgisayar.me/index.php/2015/06/22/sehirlerilceler-veritabani-ve-secenek-menusunu-sehirlere-gore-ilceleri-guncelleme/</link>
		<comments>https://www.bilgisayar.me/index.php/2015/06/22/sehirlerilceler-veritabani-ve-secenek-menusunu-sehirlere-gore-ilceleri-guncelleme/#comments</comments>
		<pubDate>Mon, 22 Jun 2015 19:49:11 +0000</pubDate>
		<dc:creator><![CDATA[Hakan Atılgan]]></dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[sehir]]></category>

		<guid isPermaLink="false">http://www.bilgisayar.me/?p=834</guid>
		<description><![CDATA[JQuery'in AJAX özelliğini kullanarak seçenek menüsünü illere göre, ilçeleri nasıl güncelleme. <a href="http://www.bilgisayar.me/dosyalar/demosehir.zip"  class="ozet yukle_color">YÜKLE</a>&#160;<a href="http://www.bilgisayar.me/demo/illerveilceler/index.php" target="_blank" class="ozet demo_color">DEMO</a>]]></description>
				<content:encoded><![CDATA[<p>Geçenlerde, Türkiye&#8217; deki şehirler ve ilçeler varitabanına ihtiyacım olmuştu. İnternette bir veritanı buldum ve bunu sizler ile paylaşmak istedim. Aynı zamanda JQuery&#8217;in AJAX özelliğini kullanarak seçenek menüsünü illere göre, ilçeleri nasıl dolduracağımızı anlatmaya çalışacağım.</p>
<p>Sadece şehirler ve İlçeler veritabanını yüklemek isterseniz <a href="http://www.bilgisayar.me/dosyalar/illerveilceler.zip">burayı <i class="fa fa-external-link"></i></a> tıklayın.</p>
<p>Bir index.php sayfası oluşturun ve aşağıdaki kodu <span class="su-label su-label-type-success">&lt;body></span> etiketinin içine yapıştırın.</p>
<pre class="prettyprint linenums" >
&lt;select id=&quot;iller&quot; style=&quot;font-size:24px&quot;&gt;
    &lt;option value=&quot;&quot;&gt;&lt;/option&gt;
&lt;?PHP
    //veritabanına bağlantı yapmayı unutmayın.
    $sql = &quot;SELECT id,sehir from iller ORDER BY sehir ASC&quot;;
    $result = $mysqli-&gt;query($sql);
    $opt = &#039;&#039;;
    while($nt=$result-&gt;fetch_array()){
        $opt .= &#039;&lt;option value=&quot;&#039;.$nt[&#039;id&#039;].&#039;&quot;&gt;&#039;.$nt[&#039;sehir&#039;].&#039;&lt;/option&gt;&#039;;
    }
    echo $opt;
?&gt;    
&lt;/select&gt;
&lt;select id=&quot;ilceler&quot; style=&quot;font-size:24px&quot;&gt;&lt;/select&gt;
</pre>
<p>Oluşturmuş olduğunuz index.php sayfasında, <span class="su-label su-label-type-success">&lt;/body></span> etiketini tam üstune aşağıdaki jquery kodunu yapıştırın.</p>
<pre class="prettyprint linenums" >
&lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
$(document).ready(function(){
    $(document).on (&quot;change&quot;,&quot;#iller&quot;, function(){
        var menuid = $(this).val();
        $.ajax({
            type: &quot;POST&quot;,
            url: &quot;ajax.php&quot;,//&quot;models/ajax.php&quot;,
            data:  &quot;id=&quot; + menuid,
            success: function(html){
                $(&quot;#ilceler&quot;).html(html);
            }
        });
    });
});
&lt;/script&gt;
</pre>
<p>Daha sonra ajax.php sayfası oluşturun ve aşağıdaki kodu bu sayfanın içine yapıştırın.</p>
<pre class="prettyprint linenums" >
&lt;?PHP include &quot;db.php&quot;;// veritabanı bağlantısının olduğu sayfa
    $sql = &quot;SELECT `id`,`ilce` from `ilceler` WHERE `sehir_id`=&quot;.(int)$_POST[&#039;id&#039;].&quot; ORDER BY `ilce` ASC&quot;;
    $result = $mysqli-&gt;query($sql);
    $opt = &#039;&#039;;
    while($nt=$result-&gt;fetch_array()){
        $opt .= &#039;&lt;option value=&quot;&#039;.$nt[&#039;id&#039;].&#039;&quot;&gt;&#039;.$nt[&#039;ilce&#039;].&#039;&lt;/option&gt;&#039;;
    }
    echo $opt;
?&gt; 
</pre>
<p></p>
<div style="text-align:center; width:100%">
<a href="http://www.bilgisayar.me/demo/illerveilceler/index.php" target="_blank" class="buttons btn_red left"><span class="left">Demo</span></a>
<a href="http://www.bilgisayar.me/dosyalar/demosehir.zip" target="_self" class="buttons btn_blue left"><span class="left"><i class="fa fa-download"></i> YÜKLE</span></a>
</div>
<p>&nbsp;<br />
&nbsp;<br />
&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://www.bilgisayar.me/index.php/2015/06/22/sehirlerilceler-veritabani-ve-secenek-menusunu-sehirlere-gore-ilceleri-guncelleme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
