使用img src url传递多个php变量


Passing multiple php variable using img src url

我是PHP新手。创建具有多个页面的应用程序。

Sample1.php

$queue=$_POST['element_3'];//Customer name
$month=(int)$_POST['month'];//month as value 06
$std_yy = $_POST['year'];// 2016
<img src="trend_g.php?element_3=$queue&month=$std_mm&year=$std_yy" /> //does not work
<img src="trend_g.php?element_3=Apple&month=06&year=2016" />//works

trend_g.php

$queue=$_GET['element_3'];
$month=(int)$_GET['month'];
$std_yy = $_GET['year'];

请帮我通过URL传递变量。我也试过下面的方法

<img src="trend_g.php?element_3='.$queue.'&month='.$std_mm.'&year='.$std_yy.'" /> //didnt work.

看了各种各样的选择,但我被困在这里。任何帮助都非常感谢!

在PHP中调用img元素时,即在PHP结束标记(?>)之前

改变
<img src="trend_g.php?element_3=$queue&month=$std_mm&year=$std_yy" />
<img src="trend_g.php?element_3=Apple&month=06&year=2016" />

echo '<img src="trend_g.php?element_3='.$queue.'&month='.$std_mm.'&year='.$std_yy.'" /> ';
echo '<img src="trend_g.php?element_3=Apple&month=06&year=2016" />';

编辑

如果你关闭了php,那么你需要修改

<img src="trend_g.php?element_3=$queue&month=$std_mm&year=$std_yy" />

<img src="trend_g.php?element_3=<?php echo $queue;?>&month=<?php echo $std_mm;?>&year=<?php echo $std_yy;?>" />