Skip to content Skip to sidebar Skip to footer

What Is Wrong With This Code Please? (form Passing Variables)

I have this code. Trying to pass form values from one internal page to the other and it's not working. Here's the code:

Solution 1:

Your action should be the php script that is going to process your post variables and method should be post.

<formaction="somefile.php"method="post">

Solution 2:

Most likely the error is here:

<form action="post" name="myform">
        <inputtype="text" value="" name="mytext" />
        <inputtype="submit" value="submit" />
</form>

action is supposed to be the handler of the form, either the same page or another one (where the php script that elaborates the form resides). POST is the METHOD. (which can be either GET or POST)

So it should be:

<formaction=""method="POST"name="myform"><!-- action = "" reloads the same page, otherwise you could write action="myphppage.php" or whatever --><inputtype="text"value=""name="mytext" /><inputtype="submit"value="submit" /></form>

Solution 3:

<formaction="post"name="myform">

is wrong.

It should be something like:

<formmethod="post"name="myform"action="">

You need to send a POST method. The action is empty so it sends it to the page itself.

Solution 4:

The 'action' should be the page that is the destination URL. You have mixed up method="post" with action="post". Set the action as "second_page.php".

I didn't fully understand what you meant by internal page, but if it is the same page, only a different div, then leave the action as blank(action='').

Post a Comment for "What Is Wrong With This Code Please? (form Passing Variables)"