PDA

View Full Version : Sending forms via post method



d-machine
01-28-2012, 09:57 AM
Hi,

On my first page I have a simple form:



<form action="page2.htm" method="post">
<input type="text" name="firstname" />
<input type="submit" />
</form>


I want to print on "page2.htm" the value of the firstname.

How can I do it?

TwitterRooms
01-28-2012, 02:16 PM
<?php
echo $_POST['firstname'];
?>

and your in the wrong forum

d-machine
01-28-2012, 07:10 PM
I know how to do it in php but I don't want to use any server-side lagnuage :)

djr33
01-28-2012, 08:04 PM
https://www.google.com/search?q=retrieve+post+in+javascript

Javascript cannot access post data because post data is sent directly to the server and is not part of the next page that loads.
Javascript can access get data in the URL, although it is a little difficult to program (but see some examples in some of the discussions in those search results).

jscheuer1
01-28-2012, 11:14 PM
I know how to do it in php but I don't want to use any server-side lagnuage :)

Then there's little point in posting the form. What good will it do?

djr33
01-29-2012, 12:11 AM
That's true-- you could do this using Javascript by not submitting the form. Copy the values of the inputs into variables then hide the form.