+ 1

How do i display form details in another page??

Hi,I am new to html.I know how 2 create a form.But I need 2 display d details entered in d form in a new page.Can anyone​ show me how I can accomplish this.I would appreciate if d code s sent as well and a brief explanation. Thanks ☺☺

26th Jun 2017, 12:39 PM
Karan V
Karan V - avatar
1 Resposta
+ 3
// index.html <form action="lol.php" method="POST"> <input type="text" name="something"><br> <button type="submit">Submit</button> </form> // lol.php <?php echo $_POST["something"]; ?> a simple approach, if u want this to work idk if u can do it on sl but u need a web server either apache or nginx and php installed. another way without php is to use method="GET" but u have to parse url with regex. if u change the form tag to <form action="" method="GET">, the form is submitting to itself. so the link will be blablabla/index.html?something=abcdefghij something like this and to get the abcdefghij u can parse with location.href in javascript > location.href // blablabla/index.html?something=abcdefghij > location.href.replace(/.+something./, "") // abcdefghij EDIT: PHP ISNT THE ONLY WAY and if u wanna learn more about these backend stuff join this discord server https://cheeze.club/zvwr its easier for us to post code blocks rather than on q&a since they dont support markdown
26th Jun 2017, 12:51 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar