Welcome to WebmasterWorld Guest from 54.198.93.179

Forum Moderators: open

Message Too Old, No Replies

I need a script

Need javascript to transport data

     
1:18 pm on Dec 23, 2009 (gmt 0)

10+ Year Member



Anybody know of a Javascript (or any other kind) that can transport text from a form on one page into a form on another page? For example, on page1.html I want to have a box where somebody enters their email address. When they click "submit" they go to page2.html where their email address has been entered inot a form and they then must fill in more data before the registration is sent to the database.
5:45 pm on Dec 23, 2009 (gmt 0)

5+ Year Member



That could be easily done with JavaScript or PHP.

In JavaScript or PHP, you could set a cookie to the user that is retrieved when the second form loads, and then is spit out into the fields that have already been filled out.

You could use AJAX programming to value check and insert the values into the database, or whatever other action, asynchronously, meaning no page reload. Hooray.

Perhaps the simplest way, and the way I would do it, is using a $_POST variable.

<input type="text" name="uniquename" />

on the next page, you would access the variable as such
$_POST['uniquename'];

Alternatively you could use $_GET and place the user value in to the browser request URI, but $_POST is more secure and when possible should be first choice.

8:14 pm on Dec 23, 2009 (gmt 0)

10+ Year Member



Thanks. Since I am not an expert programmers, can you suggest where I can find a script that would do this?
9:04 pm on Dec 23, 2009 (gmt 0)

5+ Year Member



Around the site the are excellent examples and tutorials. For a primer on PHP programming, start here:

[w3schools.com...]

Assuming you made the form on the previous page and have some understanding of PHP, on the page2.html or what have you, the variables from the form can be accessed as such:

$_POST['input_tag_name'];

Input tag name being of course, the value of the name attribute in the input tag. Once you have the variable, you could print it to an input field, which would allow further editing if desired, like so:

<input type="text" name="unique_name" value="<? echo $_POST['unique_name']; ?>" />

Does that help any?

 

Featured Threads

Hot Threads This Week

Hot Threads This Month