date function in html5 integrated with php

0

Well, I'm programming in php an integration with a process management software called BPM. I had to create a small form in html and pass certain information between them on the date. As I was passing the information it dates from the error. (The other fields of textvalues and numbervalue exemplify what I wanted to do). I think it has something to do with the format of date pq when I printo $ date it printa in year / month / day format  Can anyone help? follow the code

html:             

          Subject:

       

          Name:

    

        E-mail:

<p>
    Telefone:<br />
    <label for=telefone"> (formato: (DDD)xxxxxxxxx):</label><br/>

</p>


<p>
    Salário(em reais):<br />
    <input type="number" size="35" required="" name="salario" >
</p>

 <p>
  Cargo: <br />
    <select name="cargo">
      <option value="ADVOGADA">ADVOGADA</option>
      <option value="ANALISTA DE BI">ANALISTA DE BI</option>
      <option value="ANALISTA DE CONTROLE DE QUALIDADE">ANALISTA DE CONTROLE DE QUALIDADE</option>
      <option value="ANALISTA DE PESQUISAS OPRACIONAIS">ANALISTA DE PESQUISAS OPRACIONAIS</option>
      <option value="ANALISTA DE PPC">ANALISTA DE PPC</option>
      <option value="AUXILIAR DE COIZNHA">AUXILIAR DE COZINHA</option>
      <option value="AUXILIAR DE VENDAS">AUXILIAR DE VENDAS</option>
      <option value="AUXILIAR DE SERVIÇOS GERAIS">SERVIÇOS GERAIS</option>
      <option value="CODIFICADOR DE DADOS">CODIFICADOR DE DADOS</option>
      <option value="CONS. COMER, EXECUTIVO JR">CONS. COMER. EXECUTIVO JR</option>
      <option value="CONSULTOR COMERCIAL">CONSULTOR COMERCIAL</option>
      <option value="CONSULTOR COMERCIAL DE QUALIDADE">CONSULTOR COMERCIAL DE QUALIDADE</option>
      <option value="DESENVOLVEDOR DE SOFTWARE">DESENVOLVEDOR DE SOFTWARE</option>
      <option value="DESENVOLVEDOR WEB">DESENVOLVEDOR WEB</option>
      <option value="GERENTE COMERCIAL">GERENTE COMERCIAL</option>
      <option value="GERENTE DE RECURSOS HUMANOS">GERENTE DE RECURSOS HUMANOS</option>
      <option value="GESTORA DE RELACIONAMENTOS">GESTORA DE RELACIONAMENTOS</option>
      <option value="JORNALISTA">JORNALISTA</option>
      <option value="PROGRAMADOR JR">PROGRAMADOR JR</option>
      <option value="TRAINEE DE RH">TRAINEE DE RH</option>
      <option value="WEB DESIGNER">WEB DESIGNER</option>
    </select>

    Industry:                Administrative           DEV           Financial General           Infra           Intelligence           Legal           Marketing           Operations           Partnerships           Product           RH           Site Ops           YOU           Sales     

        Gender: Female              male         female     

Computer Type:
             Sales         DEV         BI         Design         none     

Type of phone:
             External         Internal         none        

        Expected start date:

               

</body></html>

php

$ subject = $ _POST ['subject']; $ name = $ _POST ['name']; $ email = $ _POST ['email']; $ phone = $ _POST ['phone']; $ salary = $ _POST ['salary']; $ computer_type = $ _POST ['computer_type']; $ type_of_phone = $ _POST ['typeofphone ']; $ charge = $ _POST ['charge']; $ sector = $ _POST ['sector']; $ sex = $ _POST ['sex']; $ data = $ _POST ['data'];

echo $ subject; echo $ name; echo $ email; echo $ phone; echo $ salary; echo $ computer_type; echo $ phone_type; echo $ charge; echo $ sector; echo $ sex; echo $ data;

ini_set('soap.wsdl_cache_enabled',0);
ini_set('soap.wsdl_cache_ttl',0);

$client = new SoapClient('http://cloud.sydle.com/seed/services/EventWS?wsdl', array('exceptions' => 0));

$function = 'sendMessageToStartEvent';

$arguments = array(
    'AuthToken' => array('login' => '[email protected]', 'password' => 'lucas2017', 'authType' => '','callerAddr' => '','sessionId' => '',),
    'StartMessage' => array(
        'processId' => 'contratacao',
        'processVersionId' => '1.0',
        'startMessageEventId' => 'comecarprocesso',
        'subject' => $assunto,
        'attributeValues' => array(
            'booleanValues' => array(
                array('attributeId' => 'usandoWS', 'value' => true)
            ),
            'composedAttributeValues' => array(),
            'dateTimeValues' => array(),
            'fileValues' => array(),
            'numberValues' => array(
            array( 'attributeId' => 'salario', 'value' => $salario),
            array( 'attributeId' => 'telefone', 'value' => $telefone)
            ),
            'textValues' => array(
                array( 'attributeId' => 'tipoDeComputador' , 'value' => $tipo_de_computador),
                array( 'attributeId' => 'tipoDeTelefone'   , 'value' => $tipo_de_telefone),
                array( 'attributeId' => 'cargo'            ,'value' => $cargo),
                array( 'attributeId' => 'setor'            ,'value' => $setor),
                array( 'attributeId' => 'sexo'             ,'value' => $sexo),
                array( 'attributeId' => 'nome'             ,'value' => $nome),
                array( 'attributeId' => 'email'            ,'value' => $email)
            )
        )
    )
);

   $result = $client->__soapCall($function, $arguments);
    
asked by anonymous 23.01.2017 / 15:10

1 answer

0

By default, sending the HTML5 Date field is sent in the format YYYY-MM-DD for PHP. If you want, you can use the createFromFormat function to convert the date to the desired format.

<?php
// Orientado a Objetos
$date = DateTime::createFromFormat('Y-m-d', $data);
echo $date->format('d-m-Y');

//Procedural
$date = date_create_from_format('Y-m-d', $data);
echo date_format($date, 'd-m-Y');
?>

Remember, if you want other formats, you can consult the official PHP documentation to see how it does.

Doc: CreateFromFormat

    
23.01.2017 / 18:07