Skip to content Skip to sidebar Skip to footer

Keep Form Value After Submit It

I know there are lots others question like this and i found 1.000 answer on the web but none of those work with my code :( So can someone help me with how to keep email value after

Solution 1:

try using $_POST['lastname'] instead of $_GET['lastname']

Solution 2:

1)If i am not wrong,i don't see any field with name="lastname" in your code above.

2)Use $_POST because you are posting your form data with method="post".

Solution 3:

Assuming that your file have .php as extension and php is installed on your server i would like you to notice that you have an error because you used a POST form while when you apply value to your input field you are trying to use $_GET Further more you did not assign lastnameto any input field, so use emailinput as you apply to this field name="emailinput". You should change htmlspecialchars($_GET['emailinput']); to be htmlspecialchars($_POST['emailinput']);

So your code would look like this

<inputtype="email"name="emailinput"id="emailinput"value = "<?phpecho htmlspecialchars($_POST['emailinput']); ?>" />

This should print your variable inside your input field

Solution 4:

There are at least 2 problems there.

  1. The fact that the php is displayed inline suggests that either you have wrong file extension (like the comments suggested), either file is not included in your "know how to read by php" (for lack of a better way to say it, my English is not perfect) directory.

  2. You echo a get when you sent a post (as other answer suggested)

Also... WHY DOES YOUR QUESTION HAVE JS TAG (sorry for caps, wanted to be sure it sticks out)?

Post a Comment for "Keep Form Value After Submit It"