Jump to content

pre fill a comments box


mwl707

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.