dongsuishou8039 2015-07-04 05:35
浏览 30
已采纳

在php中关闭按钮单击事件动态地为文本框分配值[关闭]

This is my Html Code :

<input type="text" id="state" name="state"  autocomplete="off">
<input type="text" id="district" name="district" autocomplete="off">
<input name="Submit" type="submit" value="Submit">

and this is my php code in server side :

if(isset($_POST['Submit'])){        
    $state = $_POST['state'];
    //what we have to write here to assign this value to 2nd textbox.   
}   

Please help me to solve this.....

  • 写回答

1条回答 默认 最新

  • douxiangshi6568 2015-07-04 06:04
    关注

    Well if you're involving PHP, then it's not going to be as smooth as JavaScript (you'll see the screen refresh).

    In this case as well you will need to have the form and the PHP on the same page:

    <?php
    
    $district = "";
    $state    = "";
    
    if(isset($_POST['Submit'])){        
        $state = $_POST['state'];
        $district = $state;
    }
    
    ?>
    
    <form method="post" action="">
    
    <input type="text" id="state" name="state" value="<?php echo $state; ?>" autocomplete="off">
    <input type="text" id="district" name="district" value="<?php echo $district; ?>" autocomplete="off">
    <input name="Submit" type="submit" value="Submit">
    
    </form>
    

    So once you type something into the first text field, and submit, you'll see that it appears in the second text field.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么