Click here to Skip to main content
15,878,003 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am trying to pass array using form post method.

submit.php :
<form method="post"  action="makepub.php"> 
....  Loop
echo '<table><tbody><tr><td align="center">';
echo '<input type="checkbox" name="file_list[]" value="'.$pr.'">' ;
echo '</td></tr></tbody></table><table><tbody><tr /></tbody></table>';	
....  Loop end

makepub.php :
if (isset($_POST['submit1'])) { 
	$file_list = $_POST["file_list"];
	$how_many = count($file_list); 
echo 'Total No of Public files chosen : '.$how_many.'<br><br>'; 
if ($how_many>0) { 
	echo 'You changed following files to public : <br>'; 
for ($i=0; $i<$how_many; $i++) { 
	echo  ($i+1) . '- ' . $file_list[$i] . '<br>'; 
	//  Some code here
	echo "<br><br>"; 

Ok these two files works perfectly on my localhost with XAMPP.
php version 5.3

but on my server array is not getting passed.
I checked by replacing the array with single variable. Even so nothing is passed to file makepub.php

Is there anything i am missing with post here ???
Any suggestion is appreciated.

Updated 9-Dec-10 7:06am
E.F. Nijboer 9-Dec-10 13:08pm    
XAMPP is also installed on (files are deployed to) the server?

1 solution

No i don't have XAMPP for my server however.
I have narrowed down my problem. :

The method in makepub.php fails that may be due old values that remains there and thus shows unpredicted behaviour. If i want to flush my variables how can this be done effectively while not destroying the sessions.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900