Page 1 of 1
$_POST problem
Posted: Wed Aug 15, 2007 6:23 pm
by movieplace.gr
https://69.65.104.25:8443/sitepreview/h ... eesstt.php
in this page i have 3 examples that post values.... none of them works to the server....
the strange is that localy works fine....
i have also the phpinfo and at the bottom the source code... (with php)...try it localy... it works perfect....
what's wrong????
please... heeeeeeeeeelllllllllppppppppppppppppppp me....
Posted: Wed Aug 15, 2007 6:37 pm
by superdezign
What does your code look like?
Posted: Wed Aug 15, 2007 6:39 pm
by movieplace.gr
***** Please use the Code: Select all
Tag when posting code *****[/color]
Code: Select all
<form action="tteesstt.php" method="post" enctype="multipart/form-data">
<select name="test[]" multiple="multiple">
<option value="one">one</option>
<option value="two">two</option>
<option value="three">three</option>
<option value="four">four</option>
<option value="five">five</option>
</select>
<input type="submit" value="Send" />
</form>
<?php
$test=$_POST['test'];
if ($test){
foreach ($test as $t){echo 'You selected ',$t,'<br />';}
}
?>
<?
if ($HTTP_POST_VARS['check']) {
$box=$HTTP_POST_VARS['box1']; //as a normal var
$box_count=count($box); // count how many values in array
foreach ($box as $dear) {
echo $dear."<br>";
}
echo "<hr>";
}
?>
<form name="hede" method="POST" action="">
<input type="checkbox" name="box1[]" value="1"> 1
<input type="checkbox" name="box1[]" value="2"> 2
<input type="checkbox" name="box1[]" value="3"> 3
<input type="checkbox" name="box1[]" value="4"> 4
<input type="checkbox" name="box1[]" value="5"> 5 <br><br>
<input type="checkbox" name="box1[]" value="6"> 6
<input type="checkbox" name="box1[]" value="7"> 7
<input type="checkbox" name="box1[]" value="8"> 8
<input type="checkbox" name="box1[]" value="9"> 9
<input type="checkbox" name="box1[]" value="10"> 10 <br><br>
<input type="submit" name="check" value="SEND">
</form>
<form action="tteesstt.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<label>
<input type="file" name="arxeio" id="arxeio" />
</label>
<label>
<input type="submit" name="button" id="button" value="Submit" />
</label>
</form>
<?php
$arxeio=$_FILES['arxeio']['name'];
echo 'You selected ',$arxeio,'<br />';
?>
<?php
phpinfo();
?>
Posted: Wed Aug 15, 2007 6:40 pm
by movieplace.gr
i don't think that the code has problem.... i think that something is going wrong with php.... maybe with php.ini
Posted: Wed Aug 15, 2007 6:50 pm
by superdezign
movieplace.gr wrote:i don't think that the code has problem.... i think that something is going wrong with php.... maybe with php.ini
Some friendly advice... ALWAYS assume it's your code first. In this case, it certainly looks like it is.
Why do you use HTTP_POST_VARS? What PHP version are you using?
Where does $_POST['test'] come from?
Posted: Thu Aug 16, 2007 2:08 am
by movieplace.gr
i dont want to change the code.... tha code works fine everywhere except from my VPS.
The $_POST comes from the same page....
copy the source code and run it....
something is going wrong with php.... but what???
Posted: Thu Aug 16, 2007 5:54 am
by superdezign
movieplace.gr wrote:i dont want to change the code.... tha code works fine everywhere except from my VPS.
The code uses variables that may not exist, and uses HTTP_POST_VARS, which is outdated and has been for quite some time.
movieplace.gr wrote:The $_POST comes from the same page....
Okay, I see it now.
movieplace.gr wrote:copy the source code and run it....
What for? It's not my script.
movieplace.gr wrote:something is going wrong with php.... but what???
I assure you, PHP is fine. Your script doesn't do anything that would require different settings in PHP aside from not having error reporting on at all. print_r($_POST) to see the values that are posted.
Posted: Thu Aug 16, 2007 6:15 am
by movieplace.gr
the same code localy print with print_r($_POST): Array ( [test] => Array ( [0] => one [1] => two [2] => three [3] => four ) )
and on the VPS print: Array ( [test] => )
Posted: Thu Aug 16, 2007 6:26 am
by superdezign
So you get no values at all...? PHP doesn't control the posting of data, the server does. PHP gets the request directly from the server. if you print_r($_REQUEST) and still get the same result, then your server is flawed. I'm am not sure what settings would cause the server to stop accepting requests, but you really should confront your host about it.
Posted: Thu Aug 16, 2007 6:43 am
by movieplace.gr
Localy
Array ( [test] => Array ( [0] => one [1] => two [2] => three ) [phpbb2mysql_data] => a:2:{s:11:\"autologinid\";s:32:\"4040d2830fdda4044cb88c3492dc6ec0\";s:6:\"userid\";i:2;} [phpbb2mysql_sid] => 1ebbf728d6b2840d18253f87dc01b31c )
Server
Array ( [test] => )
Posted: Thu Aug 16, 2007 6:49 am
by superdezign
movieplace.gr wrote:Localy
Array ( [test] => Array ( [0] => one [1] => two [2] => three ) [phpbb2mysql_data] => a:2:{s:11:"autologinid";s:32:"4040d2830fdda4044cb88c3492dc6ec0";s:6:"userid";i:2;} [phpbb2mysql_sid] => 1ebbf728d6b2840d18253f87dc01b31c )
Server
Array ( [test] => )
You'll need to address the fact that your server only posts blank data to your host and see if they can fix it.