PDA

View Full Version : How to bring data from one page to another?



sabas
08-18-2006, 02:27 PM
I got a web page where users can type in their email address (or something), when they click on Next button to go to another page their email address will be displayed on the new page. Could anybody show me how to do that?

I wonder if Javascritp can do that or I have to resort to PHP, CGI or something?

thanks,

sabas

boogyman
08-18-2006, 02:32 PM
you can do this in javascript... and what you have to do is store the information first

sabas
08-18-2006, 02:42 PM
you can do this in javascript... and what you have to do is store the information first

Err..., how? Could you specify your solution?

mburt
08-18-2006, 02:49 PM
If all you want to do is to put a value (e-mail address in this case) onto another page, you can do this in JavaScript.


<input type="text" id="email">
<br><input type="button" onclick="document.write(email.value+'<iframe src=\yourpage.htm'\'></iframe>')" value="Submit">

shachi
08-18-2006, 02:49 PM
Did you check this post?? http://www.dynamicdrive.com/forums/showthread.php?t=11883

Well that script is written by me and if you need any help with it I can.

Twey
08-18-2006, 03:07 PM
You can do it in Javascript, but it's unreliable and quite cumbersome. A server-side script would be much easier.

sabas
08-18-2006, 03:09 PM
yeah, good information, Shachi. I'll work around on it but I'm just afraid users disable Javascript so it turns out Javascript is not a good solution. PHP is alternative?

mburt, thanks for your code. I'll give it a try.

Thanks guys,

sabas
08-18-2006, 03:13 PM
I agree with you, Twey. So your specific solution is...(code please)

shachi
08-18-2006, 05:41 PM
Yeah PHP is the best choice.

Twey
08-18-2006, 07:35 PM
I agree with you, Twey. So your specific solution is...(code please)page1.html:
<form action="page2.php">
<input type="text" name="email">
<input type="submit" value="Next">
</form>page2.php:
<?php echo($_GET['email']); ?>