Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 未定义变量-通过url传递变量_Php_Html_Url - Fatal编程技术网

Php 未定义变量-通过url传递变量

Php 未定义变量-通过url传递变量,php,html,url,Php,Html,Url,我无法让我的变量在页面上回显,即使它显示在URL中。这是通过它的链接 <a href='eventform.php?$eventname'> 它显示0,但不显示顶部url中的Mountain 2012。请帮我解决这个问题 我是否在另一页上正确显示了它?您需要: <a href='eventform.php?<?php=$eventname?>'> 在查询字符串中为其命名 为URI清理数据 清理HTML的URI 因此: 您需要: 在查询字符串中为其命名

我无法让我的变量在页面上回显,即使它显示在URL中。这是通过它的链接

<a href='eventform.php?$eventname'>
它显示0,但不显示顶部url中的Mountain 2012。请帮我解决这个问题

我是否在另一页上正确显示了它?

您需要:

<a href='eventform.php?<?php=$eventname?>'>
  • 在查询字符串中为其命名
  • 为URI清理数据
  • 清理HTML的URI
因此:

您需要:

  • 在查询字符串中为其命名
  • 为URI清理数据
  • 清理HTML的URI
因此:


您忘记在url中添加eventname=,例如:

<a href="eventform.php?eventname=<?php echo $eventname; ?>">

您忘记在url中添加eventname=,例如:

<a href="eventform.php?eventname=<?php echo $eventname; ?>">

小心这样的回音。它可能在php.ini中被禁用。@Topener
因为PHP5.4.0,所以要小心这样的echo。它可能在php.ini中被禁用。@Topener
由于PHP5.4.0,它消除了错误,但仍然没有用我的isset代码回显页面上的变量。url显示如下:sportevent/eventform.php?eventname=%3C?php%20%20%20%20echo%20htmlspecialchars(%20urlencode(%20Arathon%202012%20)%20);?%3EIt消除了错误,但它仍然不会使用我的isset代码回显页面上的var。url显示如下:sportevent/eventform.php?eventname=%3C?php%20%20%20%20echo%20htmlspecialchars(%20urlencode(%20Arathon%202012%20)%20);?%3E
<a href='eventform.php?eventname=<?php echo $eventname?>'>
<a href='eventform.php?eventname=<?php
    echo htmlspecialchars( urlencode( $eventname ) );
?>'>
<a href="eventform.php?eventname=<?php echo $eventname; ?>">