custom meta box with submit button in wordpress


Staff member
I'm making a custom meta box for wordpress plugin, and I have two inputs and one submit button in the form with an action inside the meta box. I want the submit button do the form's action only, instead of updating the post such as the publish button.

here is my meta box form:

add_action( 'add_meta_boxes', 'cd_meta_box_add' );
function cd_meta_box_add(){
add_meta_box( 'my-meta-box-id', 'Meta Box Title', 'cd_meta_box_cb', 'post', 'normal', 'high' );  

function cd_meta_box_cb(){
    <form method="POST" id="myForm" action="<?php echo plugins_url( '/proses.php', __FILE__ ); ?>">
        <ul class="sorter">
            <li><label for="pdf">URL image:</label><input class="txt" name="pdf" size="50" type="text" value="" /></li>
            <li><label for="title">Title image:</label><input class="txt" name="title" size="50" type="text" value="" /></li>
            <input class="button" type="submit" value="Submit" />
        <div id="loading" style="display:none;"><img src="<?php echo plugins_url( '/loading.gif', __FILE__ ); ?>" /></div>
        <div id="result" style="display:none;"></div>

This is in the post editor, i want myForm get action to the process.php by clicking the submit button. Is there any way to do that? i knew it's possible to do because out of the post editor it's works fine.