How can an HTML page extract parameters passed through a form?

My question is should I convert two html pages to php pages, so the called page can access its POSTed parameters, or is there a way for a called html (.html extension) page to access posted parameters?

I've been reading that because posted parameters are server-side there is no way for JavaScript to do this being client side. I've seen nothing about one html page accessing parameters if that .html page was accessed via a POST.

Here is my calling form. The called form, needs access to TransDesc (below), which is a text field.

<script type="text/javascript" language="JavaScript1.2">

// Check where we came from so that we can go to the right spot when the
// form gets posted from outside of our HTML tree.
var PostURL = '/event.html';

</script>

Enter a Donation Amount
<script type="text/javascript" language="JavaScript1.2">
document.write(
'<form name="InvGenPayDonation" 
action="'+PostURL+'" 
onsubmit="return validateForm();"
method=POST>');
</script>

<p> $ <input type='text' name='Amount' value="0.00">
</p>
<p>In honor of <span style="color: #FF0000">
<input type='text' name='TransDesc' id='TransDesc' value="" >
</p>
<input type="submit" value="Next"> <br /><br />

Answers


A static HTML file cannot access variables that have been POST'ed to it. It can't even know they're there as they're sent to the server in the HTTP request, the server then deals with them and sends the HTML page in the HTTP response. They're 'consumed' before the page is even sent to the client.

You could use GET and access them via JavaScript, or configure Apache to server .html files as PHP files instead though.


In my opinion, php is the easiest way to go, and as far as languages go is pretty easy to learn and pretty intuitive.


You'll have to either convert them to PHP or use GET instead of POST, as GET parameters are accessible through window.location.href


Need Your Help

Passing array as parameter

c arrays parameters

I want to pass an array as a parameter to another function:

C# - System Data SqlClient SqlException

c# sql sql-server sqlexception

So I am in the midst of debugging a program I have been working on quite sometime that will email the user an email that will the user an email that contains information on an error a client is hav...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.