This topic is locked

Get field values from edit screen

7/3/2007 5:05:12 AM
PHPRunner General questions
K
kenny_robb author

I need to write some code to recalculate something should a change be made to an entry. In order to do this

I need to be able to pick up a value from one of the fields when I select EDIT.
I have tried $values and $data and neither seem to work....Maybe I'm not doing it right or there is another way to do it.
Any help would be appreciated
Kenny

J
Jane 7/3/2007

Kenny,
$values array contains all values entered on the Edit page except readonly values.

If your field is readonly use this code to select required value:

global $readonlyfields;

echo $readonlyfields["FieldName"];

K
kenny_robb author 7/3/2007

Kenny,

$values array contains all values entered on the Edit page except readonly values.

If your field is readonly use this code to select required value:


ok tried Editpage onLoad
[codebox]function EditOnLoad()

{

global $where;

// Parameters:

// $where - string with WHERE clause pointing to record to be edited
$_SESSION["oldeventDuration"] = $values["eventDuration"];
}[/codebox]
event duration is the name of the field that I want to capture before it gets changed.
I get the following error
Technical information

Error type 8

Error description Undefined variable: values

URL www.aliandkenny.co.uk/mgp/mgp_demoReport_edit.php?editid1=90

Error file /home/a/k/akr_productions_co_uk/aliandkenny/mgp/include/mgp_demoReport_events.php

Error line 105

SQL query select `ID_DemoReport`, `screenName`, `eventType`, `eventGame`, `eventDate`, `eventDuration`, `eventLocation`, `eventContactName`, `eventComments` From `mgp_demoReport` where `mgp_demoReport`.`ID_DemoReport`=90

J
Jane 7/3/2007

Kenny,
I see what you're saying.

Use this code in the BeforeEdit event:

global $conn,$strTableName;

$str = "select * from ".$strTableName." where ".$where;

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);

echo $data["eventDuration"];

K
kenny_robb author 7/3/2007

Fantastic jane....superstar as usual.... <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=19411&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />