Page 1 of 1

getting object inplace of string

Posted: Wed Mar 19, 2008 11:36 pm
by pnranjith
Hi when I post something with the hidden control I'm getting [object]. I cant see the string.

its like this:

this is in edit.php

<?PHP
//note that I've kept this outside the form
echo "<input type='hidden' name='filename' value='$filename' />" ;
?>
<form>
....
</form>

this is in backendajax.js which is used with edit.php using javascript src="backend.js"

xmlHttp.open("GET", "updatedetails.php?filmname=" + name +"&musicDir="+ musicDir+"&writer="+ writer+"&filename="+ filename, true);




this is in edit_back.php

$filename = $_GET['filename'];

now when I print $filename it is priniting as "[object]" with the brackets.

all the other fields are working fine.Problem is with this only.
Thanks in advance

Re: getting object inplace of string

Posted: Thu Mar 20, 2008 7:04 am
by N1gel
I think your getting [object] because the javascript is adding the input object to the xmlHttp string. instead of the inputs value

Try

filename.value

Code: Select all

 
 
xmlHttp.open("GET", "updatedetails.php?filmname=" + name +"&musicDir="+ musicDir+"&writer="+ writer+"&filename.value="+ filename, true);
 
I think the reason it might work on text fields and not hidden is that a text field might value might default to its value. That bit is just a wild guess.

Hope that helps