Page 1 of 1

PHP MySQL lost password code

Posted: Thu Oct 16, 2008 1:19 pm
by evildrome
Hi All,

I've got a small shareware program with a few users and I need to set up a 'Retrieve your registration details' form. I've been told that PHP is the way forward. The idea is a form that the users enter their username or email into and the PHP script mails them their registration details which it gets from a MySQL database.

Not rocket science but I'm not a PHP programmer. I'll manage the SQL by myself.

Can anyone point me to a code snippet that resembles this requirement?

Thanks,

Wilson Logan.

Re: PHP MySQL lost password code

Posted: Thu Oct 16, 2008 2:26 pm
by aceconcepts
1. Create a form with the fields you require.
2. Get the input values:

Code: Select all

 
$frmErr=0;
if(isset($_POST['submit']))
{
   //check if value was entered
   if(!empty($_POST['email']))
   {
      $email=$_POST['email'];
      
      //get user's details via query
   }
   else
   {
      $frmErr=1;
   }
 
   //if there are no errors then send details
   if($frmErr==0)
   {
      //send email
   }
}
 
Does this make sense? If so i'll show you how to send the email.

Re: PHP MySQL lost password code

Posted: Sat Oct 18, 2008 4:18 am
by evildrome
OK, thanks. Thats great.

I've got my form up & going with the PHP.

I suppose now I need to know how to connect to the database and send the email. I will be able to write the SQL query.

I have MySQL and Linux.

Cheers,

Wilson.

Re: PHP MySQL lost password code

Posted: Sat Oct 18, 2008 6:28 am
by aceconcepts
Write your query then post it.

We'll then put it all together.

Re: PHP MySQL lost password code

Posted: Sat Oct 18, 2008 1:57 pm
by evildrome
Okay doaky.

I'll post again when I've got it ready.

Wilson.