doutouman6245 2011-01-05 14:58
浏览 22
已采纳

在php中创建一个表单,用于保存用户提供的信息,并将其插入另一个可打印页面

I'm working on a site that gives the users of the site pre-written letters to send to places. All the user has to do is fill out a form and hit continue, then whatever information the user put into the form (like name for example) gets plugged into a pre-written letter on a printable page. A basic example would be if the form asks for Name then you hit continue, on the printable page, it would say:

Hi, my name is Zach.

I'm using a php based content management system so it should be in php. I know this is a very simple thing to do for those who know how to do it, I unfortunately don't. Thank you in advance for your help!

  • 写回答

2条回答 默认 最新

  • doucitan2544 2011-01-05 15:07
    关注

    Suppose you have this form:

    <form action="preview.php" method="POST" >
    <input type="text" name="name" />
    <input type="submit" value"Print" />
    </form>
    

    When you hit submit, the values of all the fields (input in this case, but also textarea, selects, etc) are save to the POST array (or GET if you set method="GET").

    You access the POST and GET arrays from the preview.php page (where you want to print the name in this example) with code like this:

    <?php
      $name = $_POST['name'];
    ?>
    <p>Hi, my name is <strong><?=$name?></strong>.</p>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码