I am a new comer to PHP, and I am getting trouble focusing on how information is passed from forms towards the database.

My Form:

<select name="parentgallery" id="parentgallery">
<option value="0" ><?php _e('Choose gallery', 'nggallery') ?></option>
<?php
    foreach($this->gallerylist as $gallery) {

        //special case : we check if a user has this cap, then we override the second cap check
        if ( !current_user_can( 'NextGEN Upload in all galleries' ) )
            if ( !nggAdmin::can_manage_this_gallery($gallery->author) )
                continue;

        $name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
        echo '<option value="' . $gallery->gid . '" >' . $gallery->gid . ' - ' . $name . '</option>' . "\n";
    }                   ?>
</select>

This select I made is alongside a functional GalleryTitle var that's passed for this function on a single page. So I am speculating this is an excellent spot to pass the information towards the database :

if ($_POST['addgallery']){
    check_admin_referer('ngg_addgallery');

    if ( !nggGallery::current_user_can( 'NextGEN Add new gallery' ))
        wp_die(__('Cheatin&#8217; uh?'));

    $newgallery = esc_attr( $_POST['galleryname']);
    if ( !empty($newgallery) )
        nggAdmin::create_gallery($newgallery, $defaultpath);
}

The problem with PHP ( instead of Rails which I am accustomed to ), is I can not begin to see the lifeline of the data getting passed towards the database. I'm able to only you know what gets passed and just how it's being received.

The Question:

How do i publish towards the database my parentgallery value alongside the galleryname var?

This really is too specific to reply to not understanding the actual behavior from the create_gallery purpose of whatever existing software you are attempting to modify.

The very best I will tell you by searching only at that, is the need for your parentgallery choose around the form, appears like it ought to be available as $_Publish['parentgallery'] within the receiving function. The relaxation from the implementation, is simply too determined by the more knowledge about that existing application.