传递给新页面的 PHP 变量未显示 [英] PHP variables passed to new page not showing up

查看:33
本文介绍了传递给新页面的 PHP 变量未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为某人管理一个网站,并且我收到了前任主持人/网站管理员的所有文件.

I am looking after a website for someone and I have received all the files from the previous host/webmaster.

该网站有一个通过 paypal 的订购系统,但需要从产品页面传递两个变量 此处 到订购页面未显示.

The site has an ordering system through paypal but the two variables that are required to be passed from the product page here to the ordering page are not showing up.

订购页面的 URL 似乎正确传递了如下变量

The URL of the ordering page appears to have the variables passed correctly as below

http://www.italian-Christmas-cookies.com/orderbelow.php?p=55&ser​​vice=Angel%20Reading

但它们没有显示在订购页面上

but they are not being shown on the ordering page

代码如下所示.

<b>Personalised
 <?
echo $service;
?></b>
</p>

<p>Price: &pound;<?
echo $p;
?></b>
</p>

鉴于我希望它显示的所有内容

So given all that I would expect it to show

个性化天使阅读

价格:55 英镑

我会感谢比我更有经验的人的任何指点.

I'd appreciate any pointers from people with more experience than I have.

谢谢格伦

更新:

谢谢大家,所有的帖子都帮助了我,它给了我进步和一点教育.不知道原作者是多久以前写的代码,所以里面可能有过时的方法.

Thanks everyone, all the posts helped and it has given me progress, and a bit of education. I do not know how long ago the original author wrote the code so there might be archaic ways in amongst there.

进一步进行类似的原则是否适用于稍后的代码中,其中表单捕获一些用户输入并分配一个变量名称,例如下面的 $dateofbirth 并稍后在发送给所有者的电子邮件中使用?换句话说,目前电子邮件中未包含出生日期和其他字段

Carrying on further would similar principles apply for later in the code where the form captures some user input and assigns a variable name such as $dateofbirth below and is used later in an email to the owner? In other words at the moment the date of birth and other fields are not being included in the email

<p>Date of Birth <i>(dd/mm/yyyy)</i><br /><input name="dateofbirth" value="<? echo $dateofbirth;?>" type="text" style="width: 350px;" /></p>


<p><br /><input type="hidden" name="service" value="<?
echo $service;
?>" />

<input type="hidden" name="p" value="<?
echo $p;
?>" />
<input type="submit" value="Order now" /></p>
</form>

发送电子邮件代码在这里

The sending email code is here

$emailtext = "From: " . $clientname . "\r\n";
$emailtext .= "Service ordered: " . $service . "\r\n";
$emailtext .= "Price to pay: £" . $p . "\r\n";
$emailtext .= "Date of birth: " . $dateofbirth . "\r\n";
$emailtext .= "Questions:\r\n\r\n" . $questions . "\r\n\r\n";
$emailtext .= "Comments:\r\n\r\n" . $comments . "\r\n\r\n";
$emailtext .= $email;

总而言之,上面的代码是否过时、过时、不受支持并且需要现代化以使其工作?

In summary, is the code above old, archaic, unsupported and in need of modernising to make it work?

谢谢.

推荐答案

显然,注册全局变量"功能 (http://www.php.net/manual/en/security.globals.php) 在您的 PHP 配置.

Apparently, the "register globals" feature (http://www.php.net/manual/en/security.globals.php) is turned off in your PHP configuration.

您有两种可能性:要么打开注册全局变量"(出于充分的理由不再推荐这样做).或者您通过以下方式访问 GET 参数:

You have two possibilites: Either you turn on "register globals" (which is not longer recommended for good reasons). Or you access the GET parameters in the following way:

<b>Personalised
 <?
echo $_GET["service"];
?></b>
</p>

<p>Price: &pound;<?
echo $_GET['p'];
?></b>
</p>

这篇关于传递给新页面的 PHP 变量未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆