WordPress.org

Ready to get started?Download WordPress

Forums

"action" parameter in forms (3 posts)

  1. lelkoun
    Member
    Posted 2 years ago #

    Is it OK to use the following code in forms?

    <form action="http://'. $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] .'" method="post">

    Thanks.

    ---------
    I am not using action="options.php" because it does not work for me. Previously I was using

    <form action="<?php $_SERVER['PHP_SELF']; ?>?page=myplugin" method="post">

    but it turned out that it does not work on some webhosts that allow "multihosting" via domain aliases and special folders for each domain (the form was sent to a nonexistent URL).

  2. WraithKenny
    Member
    Posted 2 years ago #

    Did you try action="./" or action="" which if I remember right should post to itself.

  3. timDesain
    Member
    Posted 2 years ago #

    try this:
    <form action="<?php echo admin_url('index.php?page=myplugin')" method="post">

Topic Closed

This topic has been closed to new replies.

About this Topic