The $_POST['']
has to contain the name attribute of the input field and not the ID.
So to modify your code:
function silly_display_metabox( $post )
{
wp_nonce_field( basename( __FILE__ ), 'silly_extrnum_nonce' );
?>
<label for="sillyNum">Silly Number</label>
<input type="number" id="sillyNum" name="sillyNum" placeholder="Write a number...">
<?php
}
And
function silly_save_metabox( $post_id )
{
$is_autosave = wp_is_post_autosave( $post_id );
$is_revision = wp_is_post_revision( $post_id );
$is_valid_nonce = false;
if ( isset( $_POST[ 'silly_extrnum_nonce' ] ) )
{
if ( wp_verify_nonce( $_POST[ 'silly_extrnum_nonce' ], basename( __FILE__ ) ) )
{
$is_valid_nonce = true;
}
}
if ( $is_autosave || $is_revision || !$is_valid_nonce ) return;
if (array_key_exists( 'sillyNum', $_POST ) )
{
global $wpdb;
$wpdb->insert($wpdb->prefix . 'sillydata', array(
'post_id' => $post_id,
'silly_number' => $_POST['sillyNum']
));
}
}
add_action( 'save_post', 'silly_save_metabox' );
Let me know if this helps.