On my live server a shopping cart script has stopped working and I have worked out the issue is that arrays are not being passed using POST and the square bracket array notation.
I created 2 short scripts to demonstrate:
basictest1.php
Code: Select all
<html>
<head>
<title>Basic Test</title>
</head>
<body>
<form name="form1" enctype="multipart/form-data" action="basictest2.php" method="POST">
<label for="arraytest1">Array[0]</label>
<input type="text" name="arraytest[]" id="arraytest1"><br />
<label for="arraytest1">Array[1]</label>
<input type="text" name="arraytest[]" id="arraytest2"><br />
<label for="stringtest">String</label>
<input type="text" name="stringtest" id="stringtest"><br />
<input type="submit" value="Submit">
</form>
</body>
</html>
Code: Select all
<?php
die(print_r($_POST));
?>arraytest is not available using POST
stringtest is available using POST
If I change the form method to GET then it works as expected.
Can someone please help? I'm tearing my hair out as I have never experienced anything like this.
I am using PHP 5.2.6. I would post my full phpinfo() for reference but I can't .htm/.php/.txt files!
Thanks.
Stuart