Jump to content

Recommended Posts

Posted

Hi,

 

I'm trying to post a form from an html page to a php page (see below).

 

print_r($_POST); returns nothing but an empty array, however,

print file_get_contents('php://input'); correctly shows everything from the html form post data.

 

I've read around on the web and found nothing obvious that I'm doing wrong, and also contacted tch tech support who say there's nothing wrong with the server/php installation (though I have read a few comments on google that suggest it might be a weird installation php dependency/bug or something).

 

html page---sorry about the code, it's generated---

<form id="form_2" name="contactform" onsubmit="return validate_form_2(this)" action="contact.php" accept-charset="UTF-8" method="post" target="_self" enctype="text/plain" style="margin:0px;">

<div id="txt_29" style="position:absolute; left:84px; top:556px; width:45px; height:14px;-moz-box-sizing:border-box;box-sizing:border-box; overflow:hidden;">

<P class="Normal-P"><label for="edit_19"><span class="Normal-C1">Name*</span></label></P>

</div>

<div style="position:absolute; left:187px; top:556px; width:205px; height:22px; text-align:left;">

 

<input type="text" id="edit_19" name="visitorname" size="30" width="205px;" value="">

</div>

<div id="txt_30" style="position:absolute; left:84px; top:586px; width:78px; height:14px;-moz-box-sizing:border-box;box-sizing:border-box; overflow:hidden;">

<P class="Normal-P"><label for="edit_20"><span class="Normal-C1">Email address*</span></label></P>

</div>

<div style="position:absolute; left:187px; top:586px; width:205px; height:22px; text-align:left;">

<input type="text" id="edit_20" name="emailaddress" size="30" width="205px;" value="">

</div>

<div id="txt_31" style="position:absolute; left:84px; top:616px; width:76px; height:14px;-moz-box-sizing:border-box;box-sizing:border-box; overflow:hidden;">

<P class="Normal-P"><label for="combo_16"><span class="Normal-C1">Query type</span></label></P>

</div>

<div style="position:absolute; left:187px; top:616px; width:134px; height:22px; text-align:left;">

<select id="combo_16" name="querytype" size="1">

 

<option value="select" selected>Please select</option>

<option value="commisions">Commissions</option>

<option value="purchase">Purchase</option>

<option value="comment">Comment</option>

<option value="general">General questions</option>

 

</select>

</div>

<div id="txt_3" style="position:absolute; left:84px; top:646px; width:87px; height:13px;-moz-box-sizing:border-box;box-sizing:border-box; overflow:hidden;">

<P class="Normal-P"><label for="edit_1"><span class="Normal-C2">Phone number</span></label></P>

</div>

<div style="position:absolute; left:187px; top:646px; width:205px; height:22px; text-align:left;">

<input type="text" id="edit_1" name="phone" size="30" width="205px;" value="">

</div>

<div id="txt_34" style="position:absolute; left:84px; top:676px; width:75px; height:14px;-moz-box-sizing:border-box;box-sizing:border-box; overflow:hidden;">

<P class="Normal-P"><label for="text_2"><span class="Normal-C1">Comment*</span></label></P>

</div>

<div style="position:absolute; left:187px; top:676px; width:206px; height:102px; text-align:left;">

<textarea id="text_2" rows="6" cols="23" name="comment" style="height:100%; width="206px;"></textarea>

 

</div>

<div style="position:absolute; left:312px; top:787px; width:81px; height:22px; text-align:left;">

<input type="submit" id="butn_4" name="Submit" value="Submit">

</div>

</form>

 

---

the php page just has

<?php

print_r($_POST);

print file_get_contents('php://input');

?>

 

it would be a great relief to me if someone figured this out!!!

 

thanks

Posted

Welcome to the forums jfrankl :)

 

You may want to pass your action to a full url. Don't know if that will help but it's a place to start. I use Perl to handle my forms so I can't help much with PHP.

Posted

Thanks Bruce,

 

I can't give the full url as it's on a site that currently needs to be passworded until it's complete. It seems weird because I've done getting post vars before and it's been dead easy to see what they are!

 

James.

Posted

sorry, I just re-read your reply and realised that you were talking about the action in the form!

 

It wasn't that (I tried the full url and it made no difference), but I'm using webplus to make the form and it had an option beneath which I hadn't spotted for the encoding which I changed from text to application/x-www-form-urlencoded. It now works fine. Amazing how an answer can prod into the right direction.

 

Thanks Bruce!

 

James.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...