dousongqiang2585 2011-11-24 13:23
浏览 323
已采纳

php首先执行form action =“<?php echo $ _SERVER ['PHP_SELF'];?> [关闭]

php executes first with form action=" it doesn't wait 'form action=' from html... what's wrong?

<?php
if(isset($_POST['submit']))
{
    $name = $_POST['name'];
    echo "User Has submitted the form and entered this name : <b> $name </b>";
    echo "<br>You can use the following form again to enter a new name.";
}
?>

from my .htaccess. maybe it's braking the code

## Turn on and setup apache rewrite ##
RewriteEngine On
Options +Followsymlinks
RewriteBase /

## Dissable directory indexing ##
Options -Indexes

## Remove trailing slash from end of uri ##
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=301,L]

# Redirect to non.php extension
RewriteCond %{THE_REQUEST} ^GET\ /([^/]+/)*[^.]+\.php(\?[^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)\.php$  $1 [R=301,L]

## Rewrite Rules ##
RewriteRule ^([0-9-a-z-A-Z-_]+)/?$ goto.php?id=$1 [L]
RewriteRule ^account/(.*)$  $1.php [L]
  • 写回答

2条回答 默认 最新

  • doudu9148 2011-11-24 13:31
    关注

    http://php.net/manual/pt_BR/reserved.variables.server.php

    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> and <form action="" method="post"> are equals because $_SERVER['PHP_SELF'] return the script name in execution and action="" submit to the page in execution too.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决