dongzongzi0379 2015-06-23 00:34
浏览 29
已采纳

洞察如何将两个表单字段提交到2页之外的单独页面

I'm trying to think of the easiest way for me to get two fields to submit to a page that is 2 pages away. I know this isn't the best description so let me try to explain.

On page 1 will be the 2 fields, workshop title and instructor, when you click next you will be taken to the second php page that is a poll of 10 questions, when you submit it adds those results to a database and forwards you to the 3rd (different) php page that has 10 more type/text boxes and questions. The issue here is that the poll has its own polling system, while the text box questions email the results to a specific email address. I would like the 2 fields from page one to be included into that email, but how can this be done if its not on the same form?

I would like to not have them re-type the 2 fields again, and to make them hidden fields wont work either because the way the polling system works has its own submit button for each question, loses the hidden fields after submit, it just doesn't work.

I tried making the first page submit to a .txt file that holds the info until the 3rd page then it can read it, but then I have the issue with the PHP Mailer not understanding:

$f = fopen("data/title.txt", "r");
$titleA = fgets($f);

This works by itself out of the mailer.php

<?php session_start();
if(isset($_POST['Submit'])) {
$youremail = 'jsadkfjdslkfjs';

$to = $youremail; 
$mailsubject = 'Workshop Feedback Form';
$body = $fromsubject.'

$f = fopen("data/title.txt", "r");
$titleA = fgets($f);


Workshop Title:

'.$titleA.'

Instructor Name:

'.$inameA.'
'; 
mail($to, $mailsubject, $body);
?>

I know this is long. I just hope some one can point me in the right direction, I am definitely over looking something.

  • 写回答

2条回答 默认 最新

  • douye1940 2015-06-23 01:22
    关注

    You could pass those values through the URL by using $_GET and then validate it on the next page.

    Another solution would be to use cookies or server sessions.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用