My goal is to print the value entered in the Firstpage.html to basicform.html using GET or POST.
I need it to be done only using Html and JavaScript or Ajax.
Code for Firstpage.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript"> function result() { var x=document.forms["fom"]["name"].value; $_GET[0]=x; } </script> </head> <body> <form method="get" action="basicform.html" name="fom"> Your name: <input type="text" id="name" name="name" size="25" /> <br /> <input type="submit" value="submit" onclick="result()" /> </form> </body> </html> This is the code in basicform.html
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <script> function loaad() { var name = $_GET[x]; if(isset($_get(submit))) { document.write(name); } } </script> <body onload="loaad();"> </body> </html>
Localstoragefor this. The method you are using is not correct.$_GETno any methods of javascript. You should be getting error for this.