...

View Full Version : Get values from prompt and textbox in javascript. Problem.



sunnynosid
09-20-2011, 07:22 AM
1) How can i get values from one page to another in javscript? Like, in php we use post and $_Post methods to move the values from one page to another. In the same way how can i move data between two pages in javascript?

2) How can i get the value of prompt on another page? E.g.,
prompt("What is your name?", "");

Now, i want to get the value(i.e. answer of the question "What is your name?") and get that value to another page. How can i do this?

Any help is greatly appreciated.

Wanna
09-20-2011, 07:33 AM
The only easy way i know is:

page1.php


<script type="text/javascript">
var name = prompt("What is your name", "Type you name here");

window.location = "page2.php?name"+name;
</script>


page2.php


<script type="text/javascript">
alert("<?php echo $_GET['name']; ?>");
</script>

sunnynosid
09-20-2011, 07:41 AM
Thanks a lot wanna. It's very useful for me.:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum