Add Meta Post function not working

Add Meta Post function not working

I am using add post meta function to save some data and its not working

<?php //include '../../../wp-blog-header.php'; $unique = "true"; $pageID = $_GET['postID']; echo "pageID:"; echo $pageID;  echo "</br>"; $num_posts = $_GET['num_posts']; echo "num_posts: "; echo $num_posts; echo "</br>"; $num_posts_meta_key = "num_posts"; add_post_meta($pageID, $num_posts_meta_key, $num_posts , $unique) or update_post_meta($pageID, "num_posts" , $num_posts); ?> 

Can someone help me out?

In first page I am getting all values from textboxes or checkboxes in javascript and then i am passing it in URL to next page where add_post_meta function is there.

I tried using method POST ...but then it doesnt work for me. It just submit the page and come back w/o doing anything on 1st page. I tried with GET method..but nothing works.

Hence I decided to take all values like num of post, post id in javascript and then from there pass it with url by using window.location.

I am very new to wordpress plugin coding. I thought POST method in my plugin is conflicting with some other post method in post.php..not sure though..

I am writing plugin for admin panel.

Add custom markup to Wordpress menu


WordPress > wp_list_categories with no child categories listed
not sure what your problem is..

Wordpress - Is it possible to display posts within a seperate directory to the pages?
are you sure you're passing the right postID parameter? does the post exist in the database?.
Wordpress: Retriving posts of a specific custom category in a custom taxonomy
You don't really need to do add_post_meta() or update_post_meta..
Is there a good question and answer plugin for wordpress?
From the manual:.
Robots text, wordpress - block directory
The first thing this function will do is make sure that $meta_key already exists on $post_id.

inserting images into multiple tinyMCE editors in wordpress
If it does not, add_post_meta($post_id, $meta_key, $meta_value) is called instead and its result is returned..
Add tweet button on wordpress blog
<?php // This minimum code should work, though you should really check that a post  // with this id does exist. 

update_post_meta($_GET['postID'], "num_posts" , $_GET['num_posts']); ?>

79 out of 100 based on 49 user ratings 949 reviews