This topic is locked

List Screen

11/2/2011 6:08:16 AM
PHPRunner General questions
D
dcrera author

Hi
How do I reference the column name on a list.php screen eg
I list two columns on this list page, Module and Module Descr.
I want to do some validation on the Module before the going to the Edit screen, in this case how do if reference Module ?.
Thanks

C
cgphp 11/2/2011

You can access fields values in the "Process record values" event or in the "Before display" event using the $values array:

if($values['Module'] == 'test')

{

header("Location: yourlistpagename_list.php");

exit();

}
D
dcrera author 11/2/2011

Hi Christian,
Added code :
echo "My Forum ". $values["FORUM"];
Error :
Undefined variable: values

C
cgphp 11/2/2011

Do you add the code in the "Process record values" event or in the "Before display" event of edit page ? Is FORUM the real name of the field ?

D
dcrera author 11/3/2011

Hi,
function BeforeProcessList(&$conn)
echo "Hello there! ";
global $conn;

$strSQLExists = "select * from forms.user_forums where ";

$strSQLExists .= "rtrim(user_id,' ') = '".$_SESSION["ID1"]."' and rtrim(forum,' ') = '";

$strSQLExists .= $values["FORUM"]."'";

echo $strSQLExists;

$rsExists = db_query($strSQLExists,$conn);

$user=db_fetch_array($rsExists);
if($user)

{return true;

}

else

{header("Location: REDIRECT_view.php?editid1=X");

exit();

}
} // function BeforeProcessList
Error :
Hello there!

PHP error happened
Technical information

Error type 8

Error description Undefined variable: values

URL localhost/Classroom/TRAINING_COURSE_list.php?

Error file C:\Program Files\PHPRunner4.2\projects\Training\include\TRAINING_COURSE_events.php

Error line 357

SQL query
Thanks

C
cgphp 11/3/2011

Add the code to the "Process record values" event or to the "Before display" event of edit page if you want to do some validation on the fields before showing the Edit screen.

D
dcrera author 11/3/2011



Add the code to the "Process record values" event or to the "Before display" event of edit page if you want to do some validation on the fields before showing the Edit screen.