将输入中的最后数据显示为值

时间:2018-03-27 16:32:39

标签: php

我试图在输入中显示最后输入的电子邮件字符,但我收到了以下错误:

  

注意:未定义索引:第42行/home/.../themes/theme_name/lost-password.php中的youremail

当我将其值设置为

时,这些通知显示在输入而不是最后输入的电子邮件中
value="<?php echo $_SESSION['youremail']; ?>"

这是我的会议:

if(!isset($_SESSION)) 
    { 
        session_start(); 
    }

这是我的意见:

<input type="text" size="35" name="youremail" class="input" id="youremail" value="<?php echo $_SESSION['youremail']; ?>" />

我的PHP版本是 7.0.28

编辑:整个PHP

<?php 
    if(!isset($_SESSION['youremail'])){
      session_start(); 
}

    require_once dirname( __FILE__ ) . '/form-process.php';  
    $pageURL = 'http';
    //if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
    if ( isset( $_SERVER["HTTPS"] ) == "on") {$pageURL .= "s";}
        $pageURL .= "://";
    if ($_SERVER["SERVER_PORT"] != "80") {
        $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
    } else {
        $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    }   

    $action= $pageURL;
?>
<?php get_header(); ?>
<div id="primary" class="content-area">
        <main id="main" class="site-main" role="main">
            <h2><?php  _e('Şifrenizi mi Unuttunuz ','qa'); ?> ?</h2>        
        <div class="question-form">
            <form id="get-password" name="get-password" method="post" action="<?php echo $action;?>" enctype="multipart/form-data">
            <input type="hidden" name="action" value="getpassword" />
            <?php wp_nonce_field('get-password'); ?>                
                <div class="err">
                <?php
                if ($error != "") {
                if($error=="null")
                {
                    echo ' <p>'.__('Lütfen yeni şifrenizi almak için gelen maillerinizi kontrol edin!','qa').'</p>'; 
                }
                else
                    echo "<p> HATA: ".$error."</p>";
                }
                ?>
                </div> <!-- /.err -->
                <div class="text-publish2">           
                        <p><?php  _e(' Mail adresiniz','qa'); ?>: </p>                   
                            <input type="text" size="35" name="youremail" class="input" id="youremail" value="<?php echo $_SESSION['youremail']; ?>" />
                </div>   <!-- /.text-publish2 -->
                <div class="btn">               
                <div class="btn_repeat">
                    <input type="submit" name="submit" class="grey" value="<?php  _e(' Şifre Oluştur','qa'); ?>">
                </div>              
                </div>    <!-- /.btn -->                       
            </form>
        </div> <!-- /.question-form -->

        </main><!-- .site-main -->
    </div><!-- .content-area -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>

0 个答案:

没有答案