This topic is locked

BeforeAdd - Value

10/9/2008 3:18:45 AM
PHPRunner General questions
I
Isterklister author

Hello,

I have a (probably simple) problem.

I have a couple of colums in my table that points to a comment-table. It is not that important so I will explain my problem.
Lines from Visual Editor:

I have a text field

<TD class=editshade_lb style="PADDING-LEFT: 5px" width=430 colSpan=3>{build_edit_control field="kommentar" mode="add" value=$value_kommentar}&nbsp;</TD></TR></TBODY></TABLE><BR>



(Kommentar = comment in english)
Now I will put the text in my comment-table, "nsd_comment", and return the id, nsd_comment id, to store with the rest of the pages data.
Lies from Events:

function BeforeAdd(&$values,&$message,$inline)

{

// Parameters:

// $values - Array object.

// Each field on the Add form is represented as a 'Field name'-'Field value' pair

//********** Save new data in another table ************

global $conn,$strTableName;

$strSQLSave = "INSERT INTO nsd_comment (text) values (";

$strSQLSave .= $values["Field"];

$strSQLSave .= ")";

db_exec($strSQLSave,$conn);

return true;

// return true if you like to proceed with adding new record

// return false otherwise


My problem are I have now idea how to write the "Field" (int the code above $strSQLSave .= $values["Field"]; ) to get the text I wrote in text field. Can someone help me?
/Pelle

Sergey Kornilov admin 10/9/2008
$strSQLSave .= $values["kommentar"];