gina
|
| Posted: 11/12/2002, 11:17 AM |
|
I am trying to create a page where if a user enters their email address, they will be emailed their user name and password. I have edited the code from this example: http://kabwebs.com/ccsniplets/sniplets_view.php?RecNo=1...0d9e671ac96beac
I first created a record form that is based on the 'user' table of my MySql database. The text box that the person will input their email address is named {email}. On the submit button, I have custom code on the Server/Onclick Event. Here is the code:
function users_Button1_OnClick() { //users_Button1_OnClick @5-226C6E08
//Custom Code @6-2A29BDB7
// -------------------------
//Send Email @14-6F8E3C18
$db = new clsDBinternet();
global $Login;
global $REMOTE_ADDR;
global $users;
$db->query("SELECT * FROM users WHERE email=\"" . $Login->ds->email->Value . "\"");
$db->next_record();
if ( $db->f("email") == "")
$Login->Errors->AddError("\n". "Sorry. We could not find this Email address in our records.");
$email=$users->email->GetText();
$MemLogin=CCDLookUp("user_login", "users", "email = " . CCToSql($email, ccsText), $db);
$MemPass=CCDLookUp("user_password", "users", "email = " . CCToSql($email, ccsText), $db);
$to=CCDLookUp("email", "users", "email = " . CCToSql($email, ccsText), $db);
$subject = "Re: Forgotten job site Password";
$message = "Per your request, we are emailing you your job site login information.\n".
"Your Username/Login is: " .$MemLogin ."\n".
"Your Password is: " .$MemPass . "\n" .
"\n".
"Thank you for visiting our site";
mail ($to, $subject, $message);
//End Send Email
// -------------------------
//End Custom Code
} //Close users_Button1_OnClick @5-FCB6E20C
When I enter an email address in the database and try to submit, I get this error:
Fatal error: Call to a member function on a non-object in c:\program files\nusphere\apache\htdocs\737training\retrievepw_events.php on line 23
Can anyone tell me what I could be doing wrong? I use php4/templates and MySql database. Thanks
|
|
|
 |
Nicole
|
| Posted: 11/14/2002, 6:17 AM |
|
Gina,
You haven’t note what is line 23, but I suppose that is it this one:
$email=$users->email->GetText();
make sure that form’s name is "users", you can also try to use
$email=$form_name->email->Value;
|
|
|
 |
yogi
|
| Posted: 12/20/2002, 4:21 PM |
|
|
|
|
 |
|