Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems: update and textarea

Status
Not open for further replies.

ftsw

Technical User
Sep 17, 2002
9
0
0
US

Two questions:

1)This code did not update after I made connection and successfully sent all the right side variables from form into this script.I am within php tags. Can you help.
$sqla = "UPDATE faq SET f_ans='$f_ans',".
"f_question = '$f_question',".
"f_keywd1='$f_keywd1',".
"f_keywd2='$f_keywd2',".
"f_keywd3='$f_keywd3',".
"f_keywd4='$f_keywd4',".
"WHERE f_num = '$f_num'";
$resulta = mysql_query($sqla);


2)
<?php

if(!($connection = mysql_connect(&quot;localhost&quot;,
&quot;qswat&quot;,
&quot;qswat&quot;)))
exit (&quot;Could not connect to server&quot;);

if (!($db = mysql_select_db(&quot;QSWAT&quot;)))
exit(&quot;Could not select database&quot;);

$sql = &quot;select * from faq where f_num = '$f_num'&quot;;

$result = mysql_query($sql);

$row=mysql_fetch_array($result);

extract($row);

echo&quot;<H3>Update the fields in the form below</H3>\n&quot;;

echo&quot;<form action = 'faq_update.php' method='post'>&quot;;

// The one below puts the table data in the textbox but the box is extreamly long on one line!
echo&quot;ANSWER:<INPUT TYPE='text' NAME='f_ans' value='$f_ans' SIZE=500><br>&quot;;

//The bottom 2 make a nice text area but do not put table data into the box.
echo&quot;ANSWER:<TEXTAREA NAME=f_ans value=$row[f_ans] COLS=110 ROWS=8></textarea><br>&quot;;
echo&quot;ANSWER:<TEXTAREA NAME=f_ans value='$f_ans' COLS=110 ROWS=8></textarea><br>&quot;;
</form>
?>
I am probably doing somethig stupid, but after 5 hours I need a life line. Please help.




 
1) $sqla = &quot;UPDATE faq SET f_ans='$f_ans',f_keywd2='$f_keywd2',f_keywd3='$f_keywd3',f_keywd4='$f_keywd4', WHERE f_num = '$f_num'&quot;;

Bear in mind that the variables you have used may not be available depending on what version of PHP you are using.

echo $sqla;
should return the query with all values completed, if it doesn't, post again.

2)echo&quot;ANSWER:<TEXTAREA NAME=f_ans value=$row[f_ans] COLS=110 ROWS=8></textarea><br>&quot;;

should be:
echo&quot;ANSWER:<TEXTAREA NAME=f_ans COLS=110 ROWS=8>&quot;.$row[f_ans].&quot;</textarea><br>&quot;; ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top