PDA

View Full Version : Why am I loosing input?


mort
10-23-2002, 06:02 AM
I am bringing a script over from another hosting provider to my account here, and it has ceased to function correctly now it is here.

I have found what I think is the major problem, but I don't know the solution, so any input would be apreciated.

Part of the script is to collect data from forms, but the forms are generated by the scipts, so I have been using arrays in the forms, ie to collect several domain names I would have the inputs as:

<INPUT TYPE='text' NAME='domain[0]'>
<INPUT TYPE='text' NAME='domain[1]'>
<INPUT TYPE='text' NAME='domain[2]'>

etc.

This way I can just deal straight with the array $domain.

The problem is that I seem to be loosing data between the form and the script.

I have included a very basic form, which when I type '123456' into it echoes '56', and I don't understand why.

<FORM METHOD='post'>
<INPUT TYPE='text' NAME='a[0]'>
<INPUT TYPE='submit'>
</FORM>

<?PHP
echo $a[0];
echo phpinfo();
?>

Thanks in advance

Mick

pete3005
10-23-2002, 11:59 AM
it is a PHP bug as documented here

http://bugs.php.net/bug.php?id=19347

I believe Steven can help you. There was a post about it else where on this forum the other day.

Pete

harmonic
10-23-2002, 03:37 PM
try changing

<INPUT TYPE='text' NAME='domain[0]'>
<INPUT TYPE='text' NAME='domain[1]'>
<INPUT TYPE='text' NAME='domain[2]'>

to

<input type="text" name="domain['0']">
<input type="text" name="domain['1']">
<input type="text" name="domain['2']">

or

<input type="text" name="domain[]">
<input type="text" name="domain[]">
<input type="text" name="domain[]">

mort
10-24-2002, 10:28 AM
Thanks for your input, the problem is now solved.

It was down to the bug that pete mentioned.

1 Helpdesk ticket later, php gets recompiled and the bug is sorted.

Thanks All