Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Wagner Martins - SC

Imprimir id de uma variável

Recommended Posts

Olá,

 

Tenho esse código e quero gravar o valor da variável $temp_Id para imprimir na tela do usuário o $temp_id escolhido, como posso fazer isso?

 

$locais = $result['DestinationList']['diffgram']['DestinationList']['Destination'];

 

 

foreach($locais as $key=>$val)
{
//$temp_string = utf8_encode($locais[$key]['!City']);
$temp_string = $locais[$key]['!City'];
$temp_string2 = substr($temp_string, 0, strlen($searchq));
$temp_string3 = utf8_encode($searchq);
$temp_Id = $locais[$key]['!Id'];
$temp_State = $locais[$key]['!State'];
$temp_Country = $locais[$key]['!Country'];
//$pos = strpos($temp_string2, $searchq);
if ($temp_string2 == strtoupper($temp_string3)){
$temp_string = ucfirst(strtolower($temp_string));
$temp_string = ucwords ( $temp_string );
$temp_Country = ucfirst(strtolower($temp_Country));
$temp_Country = ucwords ( $temp_Country );
echo "<li>".$temp_string.", ".$temp_State.", ".$temp_Country.", ".$temp_Id."</li>";
}

 

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

ja tentei ESerra, mais naum obteve sucesso



fiz assim com a sessão mais não deu certo:

 

 

foreach($locais as $key=>$val)


{
//$temp_string = utf8_encode($locais[$key]['!City']);
$temp_string = $locais[$key]['!City'];
$temp_string2 = substr($temp_string, 0, strlen($searchq));
$temp_string3 = utf8_encode($searchq);


$temp_Id = $locais[$key]['!Id'];
$_SESSION['temp_Id']=$temp_Id;
$temp_State = $locais[$key]['!State'];
$temp_Country = $locais[$key]['!Country'];


//$pos = strpos($temp_string2, $searchq);
if ($temp_string2 == strtoupper($temp_string3)){




$temp_string = ucfirst(strtolower($temp_string)); 
$temp_string = ucwords ( $temp_string );


$temp_Country = ucfirst(strtolower($temp_Country)); 
$temp_Country = ucwords ( $temp_Country );


echo "<li>".$temp_string.", ".$temp_State.", ".$temp_Country." ".$_SESSION['temp_Id'] = "$temp_Id"."</li>";
}

 

<? 




$temp_Id=isset ($_SESSION["temp_Id"])?$_SESSION["temp_Id"]:"";


echo $temp_Id;
?>

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

E coloquei mais não aparace ali no código pois esta la em cima do código e como é muito extenso coloquei só a parte q interessa

 

 

Consegui fazer para gravar na session.

 

 

 

Agora estou com uma dúvida de como posso concatenar a variável $temp_Id.

 

 

$raw_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>


<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">


<soapenv:Header>


<LoginHeader Domain=\"AGENCIA\" Language=\"pt-BR\" Currency=\"BRL\" xmlns=\"http://xxx\">


<AccessCode>xxx</AccessCode>


<UserName>xxx</UserName>


<Password>xxx</Password>


</LoginHeader>


</soapenv:Header>


<soapenv:Body>
<SearchHotelRequest xmlns=\"http://xxx\"> 
<DestinationId> echo $temp_Id</DestinationId> 
<CheckIn>2013-06-13</CheckIn> 
<CheckOut>2013-06-16</CheckOut> 
<RoomsInformation> 
<RoomInfoType> 
<AdultsNum xmlns=\"http://xxx\">1</AdultsNum> 
<ChildrenNum xmlns=\"http://xxx\">2</ChildrenNum> 
<ChildAges xmlns=\"http://TrendOperadora.SIG.XML.DataTypes/2007/09\"> 
<short>4</short> 
<short>5</short> 
</ChildAges> 
</RoomInfoType>
</RoomsInformation> 
<MaxAvrNightPrice>0</MaxAvrNightPrice> 
<AvailableOnly>false</AvailableOnly> 
</SearchHotelRequest>
</soapenv:Body>
</soapenv:Envelope>";

 

Compartilhar este post


Link para o post
Compartilhar em outros sites


$raw_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>

 

 

<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">

 

 

<soapenv:Header>

 

 

<LoginHeader Domain=\"AGENCIA\" Language=\"pt-BR\" Currency=\"BRL\" xmlns=\"http://xxx\">

 

 

<AccessCode>xxx</AccessCode>

 

 

<UserName>xxx</UserName>

 

 

<Password>xxx</Password>

 

 

</LoginHeader>

 

 

</soapenv:Header>

 

 

<soapenv:Body>

<SearchHotelRequest xmlns=\"http://xxx\">

<DestinationId> ".$temp_Id." </DestinationId>

<CheckIn>2013-06-13</CheckIn>

<CheckOut>2013-06-16</CheckOut>

<RoomsInformation>

<RoomInfoType>

<AdultsNum xmlns=\"http://xxx\">1</AdultsNum>

<ChildrenNum xmlns=\"http://xxx\">2</ChildrenNum>

<ChildAges xmlns=\"http://TrendOperadora.SIG.XML.DataTypes/2007/09\">

<short>4</short>

<short>5</short>

</ChildAges>

</RoomInfoType>

</RoomsInformation>

<MaxAvrNightPrice>0</MaxAvrNightPrice>

<AvailableOnly>false</AvailableOnly>

</SearchHotelRequest>

</soapenv:Body>

</soapenv:Envelope>";

Compartilhar este post


Link para o post
Compartilhar em outros sites

Cara por íncrivel que pareça mais da esse erro abaixo do Soap qdo faço dessa maneira que você disse, eu já tinha feito assim antes :upset:

 


 

HTTP Error: Unsupported HTTP response status 400 Bad Request (soapclient->response has contents of the response)

Compartilhar este post


Link para o post
Compartilhar em outros sites

Qui coisa neh brother. continua a mesma coisa ainda:

 

$raw_xml =

....

<DestinationId>$temp_Id</DestinationId>

....

 

da esse erro

 

Soap Error:

HTTP Error: Unsupported HTTP response status 400 Bad Request (soapclient->response has contents of the response)

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.