This is my function in function.php file
function getcity(){
global $wpdb;
if($_POST[\'state\'])
{
$id=$_POST[\'state\
You want the global variable $post
as documented here:
http://codex.wordpress.org/Global_Variables
Declare the $post
global like so:
global $post;
Then you should be able to access the id of the post using $post->ID
.
Here is a more complete doc of the attributes available through the $post
global: http://codex.wordpress.org/Function_Reference/$post