duanjuhuo8772 2016-06-05 09:11
浏览 49

在1 html页面上使用一行代码从另一个PHP脚本打印一些东西

I don't really know how to ask this but here goes.

I would like to place a line of code on a web page and have it print what's in the php script that it points to. I guess like a counter does.

Here is the code I am testing but it's not working. Any help would be great!

The php file holding the html code..

<?php
echo<<<END
<form name="myForm" method="post" action="putform.php" onsubmit="return validateForm()">
<input type="hidden" name="btn_submit" value="1">
<input type="text" maxlength="20" size="20" name="fname" value="" class="formfieldname" placeholder="First Name"><p />
<input type="text" maxlength="20" size="20" name="lname" value="" class="formfieldname" placeholder="Last Name"><p />
<input type="text" name="email" maxlength="55" size="20" value="" class="formfieldemail" placeholder="Best Email"><p />
<input type="text" maxlength="20" size="20" name="phone" value="" class="formfieldphone" placeholder="Cell Phone"><p />
<p />
<input class="button" type="submit" name="submit" value="SHOW ME THE FREE TRAINING">
<input type="hidden" name="affiliate" value="$affiliate">
<input type="hidden" name="myip" value="$myip">
<input type="hidden" name="c" value="$id">
<input type="hidden" name="program_id" value="$id">
<input type="hidden" name="campaign" value="$campaign">
<input type="hidden" name="campaignid" value="$campaignid">
</form> 
END;
?>

Here is a sample of the HTML code that someone would visit...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>test</title>
</head>
<body>

<!-- this will be replaced with the form html code -->
<script src="example.com/test_form.php"></script>

</body>
</html>
  • 写回答

2条回答 默认 最新

  • doumang20060820 2016-06-05 09:19
    关注

    To have ability use php variables you probably should do like this:

    $myVar = <<<END
    // your html here with $campaign and $campaignId
    END;
    
    $search = ['$campaign', '$campaignId', ...];
    $replace = [$campaign, $campaignId, ...]
    $final = str_replace($search, $replace, $myVar);
    

    and use require_once(); in your html file.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题