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

Preventing overlap of number ranges

c# sql sql-server numbers logic

I failed at this problem for several hours now and just can't get my head around it. It seems fairly simple from a "human" POV, but somehow I just can't seem able to write it into code.

After successful open(), program is stalling on read()

c io low-level-io

I've been banging my head against my desk for a few hours now, trying to figure out why the following code is stalling at while(chars = read(fd, buff, BUFF_SZ)) &gt; 0). The printf on the line dire...

VBA Equivalent of Sizeof()?

c++ vba sizeof

Is there an equivalent of the C++ sizeof function in VBA?