0

Can someone give me a javascript code to get the output of a form action with a PhP file?

Something like this:

//mywebsite:

 <form action="www.website1.com/Page1.php" method="get or post">

   First name: <input type="text" name="fname"><br>

   Last name: <input type="text" name="lname"><br>

   <input type="submit" value="Submit">

   </form>

Output of www.website1.com/Page1.php:

Hello, I'm [fname] [lname].

scrappedcola
  • 10,423
  • 1
  • 32
  • 43

1 Answers1

0

You can do it in PHP as well

echo "Hello, I'm ".$_POST['fname']." ".$_POST['lname'];
Michael Tichoň
  • 281
  • 2
  • 10