2
The mysql query works with normal variable, but not with jquery post variable, example:
DOESN’T WORK
$agenda=$_POST['agenda'];
$query = mysql_query("SELECT * FROM `compromiso` WHERE login LIKE 'alanps' AND agenda LIKE '$agenda' AND ano LIKE '$ano' AND mes LIKE '$mes' AND dia LIKE '$list_day'") or die(mysql_error());
WORKS
$agenda="Agenda 1";
$query = mysql_query("SELECT * FROM `compromiso` WHERE login LIKE 'alanps' AND agenda LIKE '$agenda' AND ano LIKE '$ano' AND mes LIKE '$mes' AND dia LIKE '$list_day'") or die(mysql_error());
jquery of the post:
$.post('calendario.php', {
mes: mes,
ano: ano,
agenda: $("#agendanome").html()
}, function(resposta) {
$("#calendario").html(resposta);
}, 'html');
if I give a print $agenda;
appears "Agenda 1" both ways!
tried as well $agenda=html_entity_decode($agenda);
and it didn’t work!
Does not work means any error or no result is returned?
– rray
Probably the mistake is in:
$("#agendanome").html()
, post HTML to see what you’re sending in var agenda– Papa Charlie
if I print $agenda; "Agenda 1" appears in both ways!
– Alan PS
tried also $agenda=html_entity_decode($schedule); and had no result!
– Alan PS
That one
$("#agendanome").html()
not sending together HTML tags or blank spaces/lines? try passing atrim()
and astrip_tags()
...– Jader A. Wagner
@Jader, it worked with Trim(), Valew!!!
– Alan PS
use:
$("#agendanome").text()
, so do not pass HTML together– Papa Charlie
@Jader Since you helped him, post your answer. So this question comes out of the unanswered session.
– Edgar Muniz Berlinck