"action" parameter in forms (3 posts)

  1. lelkoun
    Posted 4 years ago #

    Is it OK to use the following code in forms?

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


    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. Ken Newman
    Posted 4 years ago #

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

  3. Nanang Rukmana
    Posted 4 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