Reputation: 55
I need help understanding why using form actions don't work on certain websites. Here is an example, and the code is below. I'm trying to fill in a text area, but it won't work. I'm sure there's a simple rule that I'm forgetting, any help would be appreciated.
<form action="http://www.boxer.senate.gov/en/contact/policycomments.cfm" method="post" target="_blank" >
<input type="submit" name="firstName" value="test">
</form>
Upvotes: 0
Views: 74
Reputation: 4868
Because certain websites reject posted data which did not originate from their server. The reason they do this is because it reduces spam. There is nothing wrong with the HTML.
# block comment spam by denying access to no-referrer requests
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{HTTP_REFERER} !.*yourwebsite.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule ^(.*)$ ^http://the-site-where-you-want-to-send-spammers.com/$ [R=301,L]
An easier method would be a two part form.
Upvotes: 0
Reputation: 905
you need to use a language to then return the data.
If you send this form to a .php file... then within the php specify:
$firstName = $_POST['firstName'];
$echo $firstName;
It will print 'test' to the document window.
Upvotes: 1