I'm learning php and html on the fly, and I am stuck with the code below. The subject row outputs the "value=subject" from the database, but the Message row does not outout the "value=comment". I can echo the $comment variable, so it is there, but not in the Text Area field. I'm sure it's a simple coding error. //-- Subject Row -- echo "<TR><TD> <B>$ndx_eve_name</B></TD><TD> <IMG SRC=\"q.gif\" ALT=\"$ndx_eve_desc\" title=\"$ndx_eve_desc\"> [COLOR="Red"]<INPUT TYPE=SUBJECT SIZE=40 NAME=\"subject\" value=\"$subject\">[/COLOR] </TD><TD></TD></TR>"; // -- Message Row -- echo "<TR><TD> <B>$ndx_msg</B> <IMG SRC=\"q.gif\" ALT=\"$ndx_body\" title=\"$ndx_body\"></TD><TD></TD> <TD><INPUT TYPE=submit VALUE=$ndx_save> <IMG SRC=\"q.gif\" ALT=\"$ndx_clk $ndx_save $ndx_str\" title=\"$ndx_clk $ndx_save $ndx_str\"> </TD></TR> <TR><TD COLSPAN=\"3\"> [COLOR="red"]<TEXTAREA value=\"$comment\" NAME=\"comment\" COLS=\"70\" WRAP=hard ROWS=\"10\"></TEXTAREA>[/COLOR] </TD></TR> Code (markup):
You shouldnt do HTML and PHP in this way as its messy. Some people chose to do it like this but i just think it creates more work than is necessary. Do this: ?> //-- Subject Row -- <TR><TD> <B>$ndx_eve_name</B></TD><TD> <IMG SRC="q.gif" ALT="$ndx_eve_desc" title="$ndx_eve_desc"> <INPUT TYPE=SUBJECT SIZE=40 NAME="subject" value="<?php echo $subject; ?>"> </TD><TD></TD></TR>"; // -- Message Row -- <TR><TD> <B>$ndx_msg</B> <IMG SRC="q.gif" ALT="$ndx_body" title="$ndx_body"></TD><TD></TD> <TD><INPUT TYPE=submit VALUE=$ndx_save> <IMG SRC="q.gif" ALT="$ndx_clk $ndx_save $ndx_str" title="$ndx_clk $ndx_save $ndx_str"> </TD></TR> <TR><TD COLSPAN="3"> <TEXTAREA value="<?php echo $comment; ?>" NAME="comment" COLS="70" WRAP=hard ROWS="10"></TEXTAREA> </TD></TR> <?php //more php code Code (markup):
papa_face is right about making your code clean, but it still doesn't answer your question. The biggest problem is that a textarea does not have a value property. The 'value' goes between the opening and closing textarea tags. So, based on papa_face's code, you want to change: <TEXTAREA value="<?php echo $comment; ?>" NAME="comment" COLS="70" WRAP=hard ROWS="10"></TEXTAREA> PHP: to: <TEXTAREA NAME="comment" COLS="70" WRAP=hard ROWS="10"><?php echo $comment; ?></TEXTAREA> PHP: Hope that helps.
Thank you both for the suggestions - fortunately I did not originally code this, but I probably should clean it up!
Glad TwistMyArm offered the solution. I kinda forgot about the actual problem you were having when I posted lol.