You should check that the variable exists before using it. isset()
will return true if a variable has been set and is not null.
For example:
update_post_meta($post->ID, "_sidebar", $_POST["link"]);
will become:
if ( isset( $_POST["link"] ) ) {
update_post_meta( $post->ID, "_sidebar", $_POST["link"] );
}
As an aside, it’s a good idea to validate your data before saving.