How to send hidden PHP variable with HTML form

后端 未结 1 1282
半阙折子戏
半阙折子戏 2021-01-29 15:40

I just thinking how to set and send PHP variable with HTML form, from first.php to second.php. Actually my first code looks that:

相关标签:
1条回答
  • 2021-01-29 16:10

    Just add a new input with type hidden within your <form> </form>

    <?php $your_php_var=5;?>
    </form>
    
        <form action='add.php' method='post'>
         <input type="hidden" name="email" value="<?php echo $your_php_var; ?>">
         <input type='text' name='account'>
         <input type='submit' value='Add'>
    </form>
    

    See more here http://www.html-form-guide.com/php-form/php-form-variables.html

    0 讨论(0)
提交回复
热议问题