Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Podpowiedzi w formularzu., [PHP][AJAX]
WoGuziczek
post
Post #1





Grupa: Zarejestrowani
Postów: 52
Pomógł: 0
Dołączył: 17.09.2008

Ostrzeżenie: (0%)
-----


Witam!

Mam przygotowany formularz do rejestracji biletów.
Od firmy dostałem wszelkie informacje i taki bajer, który po wpisaniu kilku słów w formularzu wyświetla podpowiedź.

Oto ten kod:
  1. <?php
  2. header('Content-type: text/html; charset=UTF-8');
  3.  
  4. function _get($value){
  5.    if(isset($_GET[$value])&&!empty($_GET[$value])){
  6.        return addslashes( htmlspecialchars( trim ( $_GET[$value] ) ) );
  7.    } else {
  8.        return false;
  9.    }
  10. }
  11.  
  12. if( _get('ws_id') != '' )
  13. {
  14.    switch ( _get('language') )
  15.    {
  16.        case 'bg':
  17.            $esky_WSClient = new SoapClient(null, array('location' => "http://wsbg.itexpress.pl/promo/server.php?id="._get('ws_id')."&type=promotions", 'uri' => '', 'encoding'=>_get('encoding')));
  18.            switch ( _get('request') )
  19.            {
  20.                case 'cityfinder' :
  21.                    if ( _get('country') )
  22.                    {
  23.                        $result = $esky_WSClient->__soapCall("esky_WSPromotions::prom_CityList", array(false,_get('country')));
  24.                    }
  25.                    else
  26.                    {
  27.                        $result = $esky_WSClient->__soapCall('esky_WSPromotions::prom_CountryList');
  28.                    }
  29.                    echo json_encode($result);
  30.                break;
  31.        
  32.                case 'autocomplete' :
  33.                    $result = $esky_WSClient->__soapCall("esky_WSPromotions::prom_getAirportsList", array('search'=>_get('q'),'limit'=>150));
  34.                    $html = '';
  35.                    foreach ( $result as $r )
  36.                    {
  37.                        $html .= $r->city . ', ' . $r->country . ' - ' . $r->airport . ' (' . $r->code . ')' . "\n";
  38.                    }
  39.                    echo $html;
  40.                break;
  41.            }
  42.            break;
  43.        
  44.        case 'pl':
  45.        default:
  46.            $esky_WSClient = new SoapClient(null, array('location' => "http://ws.itexpress.pl/promo/server.php?id="._get('ws_id')."&type=promotions", 'uri' => '', 'encoding'=>_get('encoding')));
  47.            switch ( _get('request') )
  48.            {
  49.                case 'cityfinder' :
  50.                    if ( _get('country') )
  51.                    {
  52.                        $result = $esky_WSClient->__soapCall("esky_WSPromotions::prom_CityList", array(false,_get('country')));
  53.                    }
  54.                    else
  55.                    {
  56.                        $result = $esky_WSClient->__soapCall('esky_WSPromotions::prom_CountryList');
  57.                    }
  58.                    echo json_encode($result);
  59.                break;
  60.        
  61.                case 'autocomplete' :
  62.                    $result = $esky_WSClient->__soapCall("esky_WSPromotions::prom_AirportsList", array('search'=>_get('q'),'limit'=>150));
  63.                    $html = '';
  64.                    foreach ( $result as $r )
  65.                    {
  66.                        $html .=  $r->airport . ', ' . $r->country . ' (' . $r->code . ')' . "\n";
  67.                    }
  68.                    echo $html;
  69.                break;
  70.            }            
  71.            break;
  72.    } // language switch
  73.  
  74. }
  75. else
  76. {
  77.    return false;
  78. }
  79. ?>


Co mam z tym zrobić?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 6.10.2025 - 22:38