This topic is locked

Undefined variable error

9/10/2008 10:42:23 PM
PHPRunner General questions
B
bochaka author

Hi,

I have modified the Event template and want the admin to be able to add users and passwords to the login table manually from his add clients page, table name _clients. The fields in his clients table are Clientid for the clients name and clientpass for the clients password and I am tying to pass them to the login table fields Username and Password.However after i press add record on the clients page I get the message undefined variable "Username" I have copied event code here, but i think it may be that i am not using the correct varibale names for login page for this template. Here is my event code.
global $conn;
$strSQLInsert = "insert into `login`(`Username`,`Password`) values ('".$Username["Clientid"]."','".$Password["clientpass"]."')";

db_exec($strSQLInsert,$conn);
return true;

Sergey Kornilov admin 9/11/2008

$Username["Clientid"] as well as $Password["clientpass"] doesn't mean anything.
If you need to pull data from other tables construct and execute SQL query that pulls data and save result in variable.