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条)

报告相同问题?

悬赏问题

  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂