doujizhong8352 2013-08-09 21:18
浏览 37

在Joomla 2.5中将“使用URL重写”设置为“是”后,自调用PHP表单不起作用

I have a self calling PHP form in a Joomla article. This article is then linked with a Menu item.

<form class="form-inline" name="test" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" onsubmit="return validateForm()" method="post" >

Before using "Use URL rewriting" the PHP form was working fine. i.e "Use URL rewriting" was set to NO.

After setting the "Use URL rewriting" to Yes the PHP self calling form doesnt submit. When the submit button is pressed, the browser throws the user to the homepage.

I want to use "Use URL rewriting"->Yes as it makes the website SEO friendly while also using the PHP self calling form. Is there a way to do both ?

Thank you in advance.

  • 写回答

1条回答 默认 最新

  • dpub33855 2015-01-21 22:23
    关注

    I was able to do this using $_SERVER['SCRIPT_URL'], but is possible that other $_SERVER array elements could do the trick too, such as $_SERVER['REQUEST_URI'], $_SERVER['REDIRECT_URL'] and $_SERVER['REDIRECT_SCRIPT_URL'].

    If not help, add this to your code

    var_dump($_SERVER);

    to show all the array elements and looking for the right ones.

    评论

报告相同问题?