×

Loading...
Ad by
  • 技多不压身,工到自然成:安省技工证书特训班,点击咨询报名!
Ad by
  • 技多不压身,工到自然成:安省技工证书特训班,点击咨询报名!

都不好意思贴出来,怕被人笑话啊:D

***********index.html********************

<html>
<head>
<title>wusong</title>
<meta htttp-equiv="Content-TType" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form action="test.php" METHOD=GET>
first name <input type=text NAME="firstname" size=20><BR>
last name <input type=text name="lastname" size=20><BR>
email address <input type=text name="emailaddress" size=40><BR>
comments<textarea NAME="comments" rows=5 cols=40></textarea><BR>
<input type=submit name="go" value="go">
</body>
</html>



**********************test.php**************************

<html>
<head>
<title>wusong</title>
<meta htttp-equiv="Content-TType" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?
";


print "$lastname<BR>\n";
print "$email<BR>\n";
print "$comments<BR>\n";
print "$go<BR>\n";

?>
</body>
</html>
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / 第一天学php,弱智问题
    html的form提交(post/get都试过了)后,在action的那个php程序里面为什么显示不出那些提交的变量,甚至用get的时候,在url里面都看见了那些变量有内容,可用 print $fieldname就是打印不出来
    • 不会是没有写。。。。。。。$_POST/$_GET吧?
      • 赫赫,你一开始就猜中了,弱智学生弱智问题:P
    • No code, No answer..
      • 谢谢:)
        • 惭愧惭愧,其实啥忙也没帮上。
    • 都不好意思贴出来,怕被人笑话啊:D
      ***********index.html********************

      <html>
      <head>
      <title>wusong</title>
      <meta htttp-equiv="Content-TType" content="text/html; charset=iso-8859-1">
      </head>
      <body bgcolor="#FFFFFF" text="#000000">
      <form action="test.php" METHOD=GET>
      first name <input type=text NAME="firstname" size=20><BR>
      last name <input type=text name="lastname" size=20><BR>
      email address <input type=text name="emailaddress" size=40><BR>
      comments<textarea NAME="comments" rows=5 cols=40></textarea><BR>
      <input type=submit name="go" value="go">
      </body>
      </html>



      **********************test.php**************************

      <html>
      <head>
      <title>wusong</title>
      <meta htttp-equiv="Content-TType" content="text/html; charset=iso-8859-1">
      </head>
      <body bgcolor="#FFFFFF" text="#000000">
      <?
      ";


      print "$lastname<BR>\n";
      print "$email<BR>\n";
      print "$comments<BR>\n";
      print "$go<BR>\n";

      ?>
      </body>
      </html>
      • 上面有一句没删除干净,抱歉,想修改,又发现rolia一个bug
        • 用$lastname=$_GET["lastname"];把变量读出来
          • 哭啊。。。。。为什么,书上写的方法出不来,你的就行,难道书过时了?完蛋了,我可是好不容易才弄到一本书啊,不要误我老师的子弟啊:(
            不过还是要谢谢你,最多继续看,有什么例子通不过,再问:P


            good nite
            • 你书上写的是程序片断吧?
              • 不是啊,我虽然1目10行,但这种还不会错啊,这里过不去特地上下文都看了一遍,没提到要get一把,这可是著名的多伦多图书馆借出来的,我才看了个头:(
                • 你的程序是PHP3的风格,php4.1前的风格是HTTP_VAR什么的,到php4.2以后都是 _GET, _POST, _SESSION这样拉。都没错
                  • 我现在的版本是4.2.2-17,但估计书按照你说的是php3了,那会有很多3的东西在4上通不过?
                    • 是的
                      • 还不向下兼容,完蛋了,先看着吧,等借到了那本hold了快半年的php5是不是又太新了?:P
                    • Don't worry, your problem is just caused by PHP configuration, if you have your own server, you may turn map_global on (it is turned off by defaut after PHP 4.2)
                    • Using global mapping doesn't mean it's PHP3, according to your file name, it should be PHP 4. And don't bother PHP 5, it's not released yet.
                      • 这是你说的php的配置文件吗?也不懂哪里去加,不过也不太想改,就用者吧,不能用在问:p
                        # PHP is an HTML-embedded scripting language which attempts to make it
                        # easy for developers to write dynamically generated webpages.
                        #

                        LoadModule php4_module modules/libphp4.so

                        #
                        # Cause the PHP interpreter handle files with a .php extension.
                        #
                        <Files *.php>
                        SetOutputFilter PHP
                        SetInputFilter PHP
                        LimitRequestBody 524288
                        </Files>

                        #
                        # Add index.php to the list of files that will be served as directory
                        # indexes.
                        #
                        DirectoryIndex index.php
                        ~
                        ~
    • 风格是这样的,不过不影响兼容。可以更改 php.ini 的参数 register_globals