duanmei1850 2018-03-13 03:12
浏览 57

从输入表单发送信息到iframe

So i have looked over quite a few post on here that all have check marks saying they got it to work and for some unknown reason i cant get it to function properly. Here is my code:

Page 1: (All this works fine the way it is besides sending the post to the iframe)

<iframe name="videoIframe" src="<?php echo $q . '/' . 'videos.php'?>" 
height="200px" width="740px" frameborder="0" scrolling="no" style="overflow: 
hidden;"></iframe>

<form action="<?php echo $q . '/' . 'videos.php' ?>" method="post" 
target="videoIframe">
<input type="text" name="ytlink" id="ytlink" placeholder="example: 
https://www.youtube.com/watch?v=zw3lkPIDWBo" required>
<input type="submit" value="submit" id="submit" method="post">
</form>

Page 2: (Iframe on parent page)

<?php
$_POST['ytlink'] = $YT;
$file_data = "<iframe class='ytvideos' src='" . $YT . "?controls=0' 
frameborder='0' allow='autoplay' allowfullscreen></iframe>" . "
"; 
file_get_contents('videos.txt'); 
file_put_contents('videos.txt', $file_data);
?>     

Can anyone see what im doing wrong here? Its driving me nuts, i have asked many questions on here that have been very helpfully answered or pointed me in the right direction but i really did check similar post on here and other sites. No solution check marked has worked for me yet. Hopefully you all can see something I am not seeing. (Security isn't important for this site at all so any method you know would be greatly appreciated. P.S: I have no backend database as of now.)

  • 写回答

1条回答 默认 最新

  • dousongqiang2585 2018-03-13 03:16
    关注

    Hi just from a quick look, shouldn't $_POST['ytlink'] = $YT; be $YT= $_POST['ytlink'];. If I'm getting the wrong end of the stick just try debugging it one step at time, I find echoing the variables is a good way to start.

    评论

报告相同问题?

悬赏问题

  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答