Send date for $ _GET

5

I need to send a date by $_GET but I can not, what is the method to make this passage?

The submission looks like this:

ajax/deletaPessoaVinculo.php?dt=2016-01-29&p=PV&a=1&pb=3&c=SUPRV

And array looks like this:

Array ( [:COD_TIPOX_VINCU] => SUPRV [:COD_IDENT_PESSO] => 3 [:DAT_INICI_VINCU] => 116122144423521 [:igj] => ibhr ) 

I'm setting up my HTML like this:

. '<td><a class="ajax-link" href="ajax/deletaPessoaVinculo.php?dt='. dataDeDMAParaAMD($vinculo->DAT_INICI_VINCU) .'&p=PV&a=1&pb=' . $w_COD_IDENT_PESSO . '&c=' . $vinculo->COD_TIPOX_VINCU . '"><i class="fa fa-times"></i></a></td>'

And to receive:

$w_DAT_INICI_VINCU = ( isset($_GET['dt']) ? $_GET['dt'] : "" );

My dataDatabase function simply puts the date in the form the server can save, described below:

<?php

if (!function_exists('eglise_dataDeDMAParaAMD')) {

    function eglise_dataDeDMAParaAMD($p_data) {

        return (strlen($p_data) === 10 ? substr($p_data, 6, 4) . '-' . substr($p_data, 3, 2) . '-' . substr($p_data, 0, 2) : (strlen($p_data) === 0 ? null : $p_data));
    }

}

I set the array at this time:

function deletaUnico($w_pagina) {
global $suc, $w_COD_TIPOX_VINCU, $conexao;

$campos = array();

$campos[':COD_TIPOX_VINCU'] = $_GET['c'];
$campos[':COD_IDENT_PESSO'] = $_GET['pb'];
$campos[':DAT_INICI_VINCU']= $_GET['dt'];
$campos[':igj'] = $suc->getCOD_IDENT();
error_log($_GET['dt']); //Aqui ja aparece o numero todo maluco
    $sqlDIV = "DELETE FROM"
        . " tbl_IGREJA_VINCULOS"
        . " WHERE"
        . " and COD_TIPOX_VINCU = :COD_TIPOX_VINCU"
        . " and COD_IDENT_PESSO = :COD_IDENT_PESSO"
        . " and DAT_INICI_VINCU = :DAT_INICI_VINCU";

error_log(print_r($campos));

try {
    $conexao->getConnection()->beginTransaction();
    $conexao->atualiza($sqlDIV, $campos);

    $conexao->getConnection()->commit();
} catch (Exception $e) {

    $conexao->getConnection()->rollback();

    die('ERRO AO ATUALIZAR BANCO DE DADOS');

    error_log('vinculoUpd.php: ' . $e->getMessage());
}
    
asked by anonymous 22.01.2016 / 17:57

1 answer

1

You can send the date with the slashes normally, however, the slashes should be replaced by their coded version (% 2F). So your request should be:

ajax/deletaPessoaVinculo.php?dt=2016%2F01%2F29&amp;p=PV&amp;a=1&amp;pb=3&amp;c=SUPRV
    
27.05.2016 / 18:51