Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Arrays within $_POST not working?


AoM_Scott

Recommended Posts

We've just bought some hosting for a new website. Everything seemed fine until I tried to install oscommerce, the install procedure was creating strange errors. I gave up the install script and put it on manually, now there is still a problem.

 

I think I've narrowed it down to a problem with PHP receiving data from forms in arrays.

 

Here is a quick example using checkboxes:

 

<?php
if ($_GET['sent'] == true) {
?>
<pre>
<?php print_r($_POST); ?>
</pre>
<?php } ?>

<form action="test.php?sent=true" method="post">
<input type="checkbox" name="test[]" value="1243">
<input type="checkbox" name="test[]" value="234">
<input type="checkbox" name="test[]" value="122">
<input type="checkbox" name="test[]" value="343">
<input type="submit">
</form>

 

When the form is submitted, the print_r shows (when any of the checkboxes are ticked, otherwise an empty array is produced):

 

Array
(
[test] => 
)

 

The expected result would be something similar to:

 

Array
(
[test] => Array
	(
		[0] => 234
		[1] => 122
	)

)

 

This has got me really confused, the only I can think of is a php.ini setting issue or something similar.

 

Does anyone have any suggestions?

 

Non-working page: https://66.70.70.160:8443/sitepreview/http/....co.uk/test.php

 

Expected result: http://www.firstclasswatches.co.uk/test.php

 

 

Scott

no outside links please

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...