For some reason the post value isn't being shown even tho in var_dump it shows that it's there.
You can see that the
$_POST["ajaxMonth"]
has a string value of "2" in the first image however when I echo it, it has nothing as show in the second image.
Here is my php
Here is my Ajax
16 Replies
you've got a superfluous $ in the variable name
I'm guessing your name attribute in your input tag is something like
name="$ajaxYear"
or something?no, the the
$_POST["ajaxMonth"]
is from the ajax itself.in the screenshot, the key is called "$ajaxMonth"
yes, thats from the ajax
$ajaxMonth:month
I'm saying if your var_dump shows $ajaxMonth as a key, and you're accessing the key ajaxMonth on $_POST, those are not the same thing
try
$ajaxMonth = $_POST['$ajaxMonth'];
dosen't work
how are you submitting your POST?
by ajax
can you share how you populate that?
like this one?
There was another one that worked I made. The values were shown there, however I can't use this one since there for different things
why is the $ there on ajaxMonth in this snippet?
thats what my teacher put as for the name.
try removing the $ sign there?
dosen't work. I know that it works tho because in the 2nd snippet it's the same name but it works.
then I don't know. The most obvious thing here is that the key in the vardump (
$ajaxMonth
) doesn't match the key you're accessing (ajaxMonth
). If that's not it, I'm blaming gremlins.i second this
$ajaxMonth:month, $ajaxYear:year
<-- this is the issue
you have to remove the $
from the name
also, make sure that you're actually sending what you expect to receive