<?php
if(!defined('ABSPATH')){
    exit; // Exit if accessed directly
}
?>

<form method="post" action="options.php" id="" class="egps_email_settings_options">

<?php 
    settings_fields( 'egps_email_settings_data' );
    do_settings_sections( 'egps_email_settings_data' ); 

    $dataout = get_option('egps_email_settings_options');

    if($dataout == null){
        Egps::egps_errordump( array("Form not saved" => "Please modify and save the form by clicking on the 'Save Changes' button.") );
        $dataout = array();
    }

    if( !isset($dataout['sender_email'])){
        $dataout['sender_email'] = "photoalbum";
    }

    if( !isset($dataout['sender_name'])){
        $dataout['sender_name'] = get_bloginfo("name");
    }
    

?>


<h3>EGPS Email Settings</h3>
   
    <table class="form-table" role="presentation">
        <tbody>

            <tr>
                <th scope="row">Sender email address:</th>
                <td>
                    <input 
                        type="text" 
                        class="egps_admin_fields_300" 
                        name="egps_email_settings_options[sender_email]" 
                        value="<?php echo esc_html($dataout["sender_email"]); ?>">@<?php echo esc_html(get_bloginfo()); ?>               
                </td>
            </tr>

            <tr>
                <th scope="row">Sender name:</th>
                <td>
                    <input 
                        type="text" 
                        class="egps_admin_fields_500" 
                        name="egps_email_settings_options[sender_name]" 
                        value="<?php echo esc_html($dataout["sender_name"]); ?>">                  
                </td>
            </tr>


        </tbody>
    </table>

    <?php submit_button(); ?>

</form>


<?php
