getting object inplace of string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pnranjith
Forum Newbie
Posts: 1
Joined: Wed Mar 19, 2008 11:09 pm

getting object inplace of string

Post 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
User avatar
N1gel
Forum Commoner
Posts: 95
Joined: Sun Apr 30, 2006 12:01 pm

Re: getting object inplace of string

Post 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
Post Reply