mwl707 Posted September 8, 2009 Share Posted September 8, 2009 Hi I am using a bit of java to prefill a comments box called 'comments' . I get the value from the code below $result = mysql_query('select * from event'); while ($i < mysql_num_fields($result)) { $meta = mysql_fetch_field($result, $i); $label = $meta->name ; $i++; $lcondition = "jobnumber = $importedjobnumber"; $lresult = mysql_query("SELECT * FROM event WHERE $lcondition") ; $row = mysql_fetch_array($lresult) ; $rte = $row["$label"] ; $$label = $rte ; At this point I KNOW that the variable $comments contains text. But to be double sure I do this $comments = $row['comments'] ; I have a form with a text box called comments and am using php/java to fill it echo "<script> document.form1.comments.value= '$comments' </script>" ; BUT nothing appears in the box. I have tried everything I know to get a display but nothing. Now the strange this is if i do this $comments = "this is a test" ; echo "<script> document.form1.comments.value= '$comments' </script>" ; it works !, Can anybody please tell me what I am doing wrong ? Link to comment https://forums.phpfreaks.com/topic/173561-pre-fill-a-comments-box/ Share on other sites More sharing options...
cbolson Posted September 8, 2009 Share Posted September 8, 2009 Hi, You say: At this point I KNOW that the variable $comments contains text. But to be double sure I do this $comments = $row['comments'] ; How do you *know* that it contains text? Have you done echo $row["comments"]; on the page to test it has a value? Chris Link to comment https://forums.phpfreaks.com/topic/173561-pre-fill-a-comments-box/#findComment-914872 Share on other sites More sharing options...
mwl707 Posted September 8, 2009 Author Share Posted September 8, 2009 Yes I have testes this with echo and it has a value Link to comment https://forums.phpfreaks.com/topic/173561-pre-fill-a-comments-box/#findComment-914961 Share on other sites More sharing options...
ldb358 Posted September 8, 2009 Share Posted September 8, 2009 can you please post the entire unaltered script so that i can see it Link to comment https://forums.phpfreaks.com/topic/173561-pre-fill-a-comments-box/#findComment-915067 Share on other sites More sharing options...
haku Posted September 10, 2009 Share Posted September 10, 2009 Hi I am using a bit of java to prefill a comments box called 'comments' Sure looks a lot like javascript to me. Link to comment https://forums.phpfreaks.com/topic/173561-pre-fill-a-comments-box/#findComment-915824 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.