WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] HTML Form within a plugin (3 posts)

  1. rj.alaskan
    Member
    Posted 1 year ago #

    I have a (hopefully) quick question. I am trying to get user input from an HTML form within a plugin I am developing.

    For instance, here is a sample ofthe form html that is on the page:


    <form method="post" action="/wp-content/plugins/myplugin/somepage.php" name="somename">

    When the form is submitted, the next page comes up just fine, I have a reCAPTCHA as well and that works fine, but the "somepage.php" does not receive any of the values from the POST form. All of the logic in "somepage.php" functions as built, but there are no values for the POST in the "somepage.php" script.

    My question is, does WordPress require you to use some sort of function for passing values inbetween scripts within functions?

    Thanks!

  2. bcworkz
    Member
    Posted 1 year ago #

    Nothing special. I get values from POSTed forms using a $_POST['field_name'] type format without issue. But it sounds like you may have some redirect going on that's dropping the data. You say "the next page comes up just fine" but the values are not in somepage.php. somepage.php should be the next page coming up, that is the action specified in the form. If anything comes up before somepage.php, that is where the fault lies.

  3. rj.alaskan
    Member
    Posted 1 year ago #

    Thanks for the reply, I re-evaluated my code after reading your reply and found the issue. It had nothing to do with WordPress, just like you said.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.