Table to Function

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
terrym
Forum Newbie
Posts: 5
Joined: Wed May 29, 2002 3:51 pm
Location: United Kingdom

Table to Function

Post by terrym »

I have this bit of code (below) with which I want to do a couple of things:

1. Take input from user into TEXTAREA NAME="metaKeywords"
2. User clicks button and the information is UPDATED in a Table.
3. The user is returned to this page.

Items 1 and 3 work fine, but I cannot figure out how to get information from the form and into the Table.

I expect it might have to be with a Function, but how do you "connect/activate" a function between clicking the button and whatever PHP_SELF does.

(The $page just put the Page number in the title)

Any advice or pointer would be most appreciated. And this is the bit of code:

<TR>
<TD WIDTH=15% ALIGN=left VALIGN=top><FONT FACE=verdana SIZE=1>Meta Keywords</FONT></TD>
<TD WIDTH=65% ALIGN=left VALIGN=top>
<FORM ACTION="<? print $GLOBALS["PHP_SELF"]."?page=".$page ?>" METHOD="post">
<TEXTAREA NAME="metaKeywords" ROWS="2" COLS="58"><? echo $keywordstr ?></TEXTAREA></TD>
<TD WIDTH=20% ALIGN=right VALIGN=top>
<INPUT TYPE="Submit" NAME="Submit1" VALUE="Insert Changes">
</FORM>
</TD>
</TR>
MattF
Forum Contributor
Posts: 225
Joined: Sun May 19, 2002 9:58 am
Location: Sussex, UK

Post by MattF »

you need to query the database like this:

$result = mysql_query("SELECT * FROM table WHERE id='1'");
$keywords = mysql_fetch_array($result);

then between your <textarea></textarea> tags you need:

echo $keywords['field_name_with_metadata'];

ok?
Post Reply