Reputation: 1249
I tried all answers of the postings of this forum but nothing helped me. I have a formular in html which should transfer a file to a php script and the answer should be displayed in an IFrame. But when I look at the $_POST or $_REQUEST variable it's almost empty. And because I've got a input field with file type in the formular I didn't expect to find an empty $_FILES variable. Only the parameters given in the action tag are available. I have a htaccess-file with rewriting and I think that the bug is in this file. But I can't find the error I made.
The htaccess looks like this:
RewriteEngine on
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.htm$ index.php?targetFile=$1.php [QSA]
RewriteRule ^applicat/(.*)\.jpg$ ../application/$1.jpg
RewriteRule ^applicat/(.*)\.gif$ ../application/$1.gif
The formular is the following:
<form id="-UPLOADER-_form" class="form" style="width:549px" action="test.php?par=ram" target="upload_target" method="POST" enctype="multipart/form-data">
<input id="targetComponent" type="hidden" value="">
<input id="method" type="hidden" value="processInput">
<input id="toUpload_file" type="file" accept="image/*" style="cursor:pointer;">
<iframe id="upload_target" style="width:200;height:300;border:0px solid #fff;" src="" name="upload_target">
<input id="unique" type="hidden" value="500da15dc03a6">
</form>
And finaly the php-file is:
<?php
print_r($_REQUEST);
?>
I already turned on the rewrite log of apache but I guess that there's nothing helpful in there:
127.0.0.1 - - [23/Jul/2012:21:14:20 +0200] [localhost/sid#453140][rid#9e9faa0/initial] (1) [perdir C:/xampp/htdocs/fritz/] pass through C:/xampp/htdocs/fritz/index.php
127.0.0.1 - - [23/Jul/2012:21:14:27 +0200] [localhost/sid#453140][rid#399ef80/initial] (1) [perdir C:/xampp/htdocs/fritz/] pass through C:/xampp/htdocs/fritz/test.php
Has anybody a helpful hint where I've bugged my code?
Best regards
Stephan
Upvotes: 2
Views: 812
Reputation: 1522
None of your inputs have the name="field_name" attribute, you need that.
Eg:
<input name="bleh" id="some_id">
To get this value you need the name attribute not id
<?php echo $_POST['bleh']; ?>
Upvotes: 1