This topic is locked

Show value from previous entry in add page

3/11/2009 2:33:03 AM
PHPRunner General questions
W
wonny author

Hi to all,
is it possible to display the value of a previous added entry in a field on a new add page? Could this be solved by JavaScript or PHP? Has anyone a glue how the code would look like? Sorry, but I´m a absolutely programming newbie and I don´t know if it so easy just to write "this.getfield"-command from JS...?!
Hope someone can help

Thanx

J
Jane 3/11/2009

Hi,
you can select required value from database in the Before process event on the Events tab and save it in the $_SESSION variable.

Here is a sample:

$str = "select Field1 from TableName Order By KeyField desc ";

$rs = CustomQuery($str);

$data = db_fetch_array($rs);

$_SESSION["Field1"] = $data["Field1"];



Then use this variable as default value on the "Edit as" settings dialog on the Visual Editor tab.