Page 1 of 1

php register form

Posted: Wed May 25, 2005 3:45 pm
by method_man
i am making a game called "Street Life" and i have made the register page but i dont know how to use php to actually have it do anything.
these are the things the registering person has to answer

First Name


Last Name

Email Address
Confirm Email Address

Sex

Date of Birth
(mm/dd/yyyy)

City

Country

how can i have it so it stores the things typed in in my database and sends an email to the person showing them all of the stuff they typed in and hav a random password that is 8 leters/numbers long?

Re: php register form

Posted: Wed May 25, 2005 3:54 pm
by Roja
method_man wrote: how can i have it so it stores the things typed in in my database and sends an email to the person showing them all of the stuff they typed in and hav a random password that is 8 leters/numbers long?
Break it into tasks:

- Store things to a database: Look at the mysql_ functions, and SQL code including INSERT and UPDATE.

- Send an email: use mail(), or http://phpmailer.sourceforge.net

- Show them what they typed in: $_POST['username'], etc.

- Random password 8 characters long: Stolen from the php mt_rand user comments..

Code: Select all

for($len=8,$r='';strlen($r)<$len;$r.=chr(!mt_rand(0,2)?
mt_rand(48,57):(!mt_rand(0,1)?mt_rand(65,90):mt_rand
(97,122))));

Posted: Wed May 25, 2005 4:01 pm
by method_man
could you please give me an example of using the mail() function?

Posted: Wed May 25, 2005 4:22 pm
by shiznatix

Code: Select all

mail($to, $subject, $message, $headers);

Posted: Wed May 25, 2005 4:25 pm
by hawleyjr
I recommend using PHPMailer There are examples on the following link:

http://phpmailer.sourceforge.net