Question

I use a method="post" form and made a test script.php to check my variables and this is what I get:

array(0) {
}
array(0) {
}
array(0) {
}
Array ( ) GET

this is my html:

<form id="contacts-form" method="post" action="contact.php" 
enctype="multipart/form-data">
<fieldset>
<div class="field"><input type="text" name="f_name"/></div>
<div class="field"><input type="text" name="f_email"/></div>
<div class="field"><input type="text" name="f_phone"/></div>
<div class="field"><textarea name="f_message" cols="1" rows="1"></textarea></div>
<div class="wrapper">
<a href="contact.php" class="link2"
onclick="document.getElementById('contacts-form').submit()" name="subjoin"> 
<span>
<span>Send Your   Message</span>
</span>
</a>
</div>
</fieldset>
</form>

here's my contact.php script:

<?php
$mypostdata = file("php://input");
print "<pre>";
var_dump($_POST);
var_dump($mypostdata);
var_dump($_GET);
print "</pre>";
print_r($_POST);
print_r($_SERVER['REQUEST_METHOD']);
Was it helpful?

Solution

Your mistake is in your link:

<a href="#" class="link2" onclick="document.getElementById('contacts-form').submit(); return false;" name="subjoin"> 

Should work because a normal link just links zu contact.php and does not submit the form.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top