dtrj74376 2014-09-02 00:21
浏览 26

too long

I am a new to this type of coding so I was wondering if someone could help me.

Here's what I want to achieve, an input field where the user can enter text and have another text appended to this. So for example, when the user enters text e.g "My Name!!", upon posting there would be another hidden text appended to this, so the server would receive "Hidden Text!","My Name!!".

Here's an image explaining this in an easier way.

enter image description here

Here is my code so far..

        <form method="post" action="jumpin.php">
            <label>Desired Username:</label>

            <div>
                <label id='labletext'><?php echo $_SESSION['user_name_custom']; ?></label>
                <input type="text" id="userid" name="userid" />
                <input type="submit" value="Check" id="jumpin" />
            </div>
<script>
    $('#userid').keyup(function(){
    $(this).css('color','#000');   
    });
    $('#userid').blur(function(){
    var value = $('#labletext').text()+$(this).val();
    $(this).val(value);
    });
</script> 
        </form>

This code doesn't seem to be working, all the server receives is the text the user submitted and not the "labletext".

  • 写回答

3条回答 默认 最新

  • dongyoucha0645 2014-09-02 00:23
    关注

    You can use a hidden input field.

    <input type="hidden" name="extra_label" value="<?php echo $_SESSION['user_name_custom']; ?>" />
    

    Not visible to your users, but the data is passed to your server.

    In your server-side code, you'll access the variable like $_REQUEST['extra_label'].

    评论

报告相同问题?

悬赏问题

  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示