display html form content before submitting

May 11, 2010 at 08:07:14
Specs: xp, 4gb
How could I display html form content before submitting via post? In other words, when I click submit, could I have a blank page show the data formatted exactly the way that it is/was submitted? I don't care if the data is shown before or after submitting it. Thx!


See More: display html form content before submitting

Report •

May 11, 2010 at 09:10:19
How the hell would you show the data BEFORE they've submitted it?

Here, maybe this is what you want:

Report •

May 11, 2010 at 10:21:58
Sorry, I meant after clicking submit but prior to transmission. I appreciate the suggestions but I am looking for some javascript or something that can capture the data as the browser would and open a new window displaying it. This may not be possible though.


Report •

May 11, 2010 at 15:39:28
You can probably do it with js... well provided the client has it enabled. :P I don't know how useful it will be, but perhaps something like below may help.

Here's a bit of php along with a js routine to display the form data and then submit it after 5 seconds.


   if(isset($_POST)) {
      print("<br /><br />");

<form name="test" action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
field 1 <input name="field1" value="" type="text">
field 2 <input name="field2" value="" type="text">
field 3 <input name="field3" value="" type="text">
field 4 <input name="field4" value="" type="text">
<input value="try it" type="button" onclick="some_function();">

<script type="text/javascript">

function some_function() {

   var fields = new Array(document.forms.test.field1.value,

   var d = document.createElement("DIV");

   d.innerHTML = "

Field 1: " + fields[0] + "</p>" +

Field 2: " + fields[1] + "</p>" +

Field 3: " + fields[2] + "</p>" +

Field 4: " + fields[3] + "</p>";

   setTimeout("document.forms.test.submit()", 5000);



Report •

Related Solutions

May 19, 2010 at 13:43:12
Seems to me that since each input has a name, that you just assign those names to variables on post.

With php..

Now just echo the variables. voila.

echo "comments:" $comments;
echo "Name:" $name;

Enter your 'Submit' or 'Cancel' buttons. Submit calls post.php and actually inserts the data into the mysql database.
Google "javascript greybox" to really make this look pretty.

Report •

May 19, 2010 at 14:33:47
Thanks, I will give it a shot.


Report •

Ask Question