Hi I have a small HTML site and was wondering if anyone knows of any simple script that I can use for my visitors to register. I was looking for something simple that would ask for email, website and store the information in a Database or TXT file. The script doesn’t have to do anything except save the information registered.
Well, if all you want is the info, why not just send the new user info to yourself in an email after someone registers. It would require an html form, and a php or asp server side script to submit to that would email you using the simple mail() function (or asp's mail function depending on what OS you site is using)... Your next easiest option is to save the info in a text file. Heres how you could do that: Make your html form. for example, <form method="post" action="process.php"> Your Name: <input type="text" name="name"><br> Your Email: <input type="text" name="email"><br><br> <input type="submit" value="Register!"> </form> Code (markup): Then make a php page, process.php to save the info. <html> <head> <title>Thank You</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php $username = $_POST(name); //name field passed from html form $useremail = $_POST(email); //user email passed from html form if(is_writable('newuser.txt')) { $fp = fopen('newuser.txt','a'); $content = "$username,$useremail\n"; fwrite($fp,$content); fclose($fp); } else { echo'File is not writable!'; } ?> <br><br><br><center> Thank You! Your registration info has been recieved!</center> </body> </html> Code (markup): Then make a simple empty text file and name it newuser.txt putting it in the same directory as the form and php process page.... This text file must be writable (change permissions on it thru your ftp client), and will hold the info in comma seperated lines. If you want to change the path to the text file, you can do it here: $fp = fopen('newuser.txt','a'); Like, sub/newuser.txt This is a very simple example and should work for you provided I didn't forget anything or make a typo best, Jan
Thanks for your help, that’s exactly what I was looking for. I wanted something really simple that lets people submit a few details.
Your Welcome Just keep in mind that the above code is not a secure form, but will give you an idea of how it works and doing a search on google will give you some additional code to add for securing the form! best, Jan