No value in POST


I have the following code
[php]echo "

<input type=‘submit’ name=’‘submit’>";[/php]

After running it and doing a var_dump($_POST) there is no entry ‘city’ => string ‘mall’ (length=4) in the POST array. Why is there no entry for the City as passed in the URL. Does the values city=mall not go into $_POST?

'city' => string 'mall' (length=4)

shows exactly what you are posting. I don’t understand the problem

The problem is there is no entry $_POST[‘city’] so in other words if I had
$test = 1;
echo "

        <input type='submit' name=''submit'></form>";


then the array $_POST would be empty and that is what I would like to know. Shouldn’t $_POST have a value of $_POST[‘city’] = mall?

As far as I understand it the values city=mall are placed in the array $_POST but with this it isn’t

Sorry, since you are passing it in the URL it is GET not POST. So you would need to use $_GET[‘city’]

OR… to accommodate both GET and POST you could use $_REQUEST[‘city’]

Another suggestion, if city is not going to be a visual input you could pass it as hidden.



This will ensure that ‘city’ is part of the $_POST variables, additionally, you can easily modify that using JavaScript.

Sponsor our Newsletter | Privacy Policy | Terms of Service