|
|
|
|
![]() ![]() |
Jul 14 2005, 11:26 AM
Post
#1
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 142 Joined: 24-September 04 From: Belgium Member No.: 1,260 |
i would like to add a form on my site, that let's you fill in your e-mail address in order to subscribe to a newsletter. Actually, i just need to see their addresses somewhere (in a textfile, database, forward to my e-mailaddress,..). How can this be done? I mean, which script do i have to use?
There is a database available. Php is enabled. I have no acces to cgi-bin, if that's needed. I hope someone can help me with this. The alternative would be that there is a link on my site so that they can mail it to me, but prefer a script |
|
|
|
Jul 14 2005, 11:28 AM
Post
#2
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 142 Joined: 24-September 04 From: Belgium Member No.: 1,260 |
Maybe the Coppermine Photo Gallery scripts are useful? The site is based on Coppermine's Photo Gallery system.
|
|
|
|
Jul 14 2005, 12:31 PM
Post
#3
|
|
|
Member [Level 3] ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 92 Joined: 28-June 05 Member No.: 8,782 |
Try this:
FORM CODE <form name="newsletter" method="post" action="newsletter.php"> <p> <input type="text" name="nl_email"> </p> <p> <input type="submit" name="Submit" value="Submit"> </p> </form> TABLE in sql CODE ID: int autoincrasing index NL_EMAIL: string newsletter.php file CODE <?php if ( isset($HTTP_POST_VARS['nl_email'])) { $nl_email = $HTTP_POST_VARS['nl_email']; $dbh=mysql_connect (HOST, USER, PASSWORD) or die ('DB is OFF'); mysql_select_db (TABLE NAME); $query = "INSERT INTO TABLE NAME (`NL_EMAIL`) VALUES ('".$nl_email."')"; $result = mysql_query($query); print "Your email is add. Nice day"; } else { print "Don't see email adress."; } ?> Dont forget to change HOST, USER, PASSWORD, TABLE NAME to right values. With this you get a list of emails putting by users on in form, if you need a script for sending this news letter just ask :] |
|
|
|
Jul 14 2005, 01:03 PM
Post
#4
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 142 Joined: 24-September 04 From: Belgium Member No.: 1,260 |
ok, thanks a lot, this is what i was looking for, but one question:
can you be more specific on what to do with the database? (in phpmyadmin) i'm not that familiar with mysql. But i do can run a query on my database. can you give me something like: CODE CREATE TABLE cpg_online ( user_id int(11) NOT NULL default '0', user_ip tinytext NOT NULL, last_action datetime default NULL, PRIMARY KEY (user_id,user_ip(15)) ) TYPE=MyISAM; thanks a lot |
|
|
|
Jul 15 2005, 01:00 AM
Post
#5
|
|
|
Member [Level 3] ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 92 Joined: 28-June 05 Member No.: 8,782 |
sql
CODE SQL-query: CREATE TABLE `nl_table` ( `ID` INT NOT NULL AUTO_INCREMENT , `NL_EMAIL` TEXT NOT NULL , INDEX ( `ID` ) ); php CODE $sql = 'CREATE TABLE `nl_table` (' . ' `ID` INT NOT NULL AUTO_INCREMENT, ' . ' `NL_EMAIL` TEXT NOT NULL,' . ' INDEX (`ID`)' . ' )'; But first you need create database in CPANEL, next create user to this database add to this user full acces, then you can create tables in this new database. MySQL Database button in CPANEL. -------------------- Practice is when evrything is work but no one know why. Theory is when work nothing but evry one know why. Programmers join Practice with Theory - nothing work and no one know why |
|
|
|
Jul 15 2005, 09:35 AM
Post
#6
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 142 Joined: 24-September 04 From: Belgium Member No.: 1,260 |
or just run the query in phpmyadmin
thanks a lot |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 6th October 2008 - 02:29 PM |