Newsletter Subscribe homepage

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jammyjames
Forum Newbie
Posts: 12
Joined: Fri Jun 30, 2006 8:45 am

Newsletter Subscribe homepage

Post by jammyjames »

Hi,

I am trying to improve my site and wanted to add a subcribe form on my homepage where only email is required. When the user hits submit they are directed to the rest of the form with the email filled in.

Does anyone know how I can do this.

I am pretty new to php any help would be great!

Thanks

James
User avatar
technofreak
Forum Commoner
Posts: 74
Joined: Thu Jun 01, 2006 12:30 am
Location: Chennai, India
Contact:

Post by technofreak »

Here is the guidelines, but you have to write your code :)

1. Have form with an input text box and a command button.
2. When the command button is clicked, it takes you to your second form where you ask the subscriber to fill further details.
3. Upon filling the second form, the sebscriber clicks submit button, thereby the details are saved in a database with email id as the primary key.
4. Optionally a mail is sent to the user, confirming his subscription.

More info:

1. the form tag can be something like this :

Code: Select all

<form method='post' action='full_form.php'> Input text box for email and submit button </form>
2. when the user enters the email id and clicks 'submit', the second form is reached. Here, the email id can be obtained with the variable --> $_POST['input_box_name']. Assign this to another variable like '$e_mail' and use this as pre-filled value in the second form for the email field, like :

Code: Select all

<input type='text' name='e_mail' value="<?php echo $e_mail; ?>" />
3. All the datas entered in the 2nd form will be $_POST['object_name'] in the subsequent page.

Add-on : For further security, you can design such that when a user subscribes with an email id, a confirmation mail is sent to the id, where there will be a link, which when clicked will bring him to a page, where he fills form 2.
This is a work-around to ensure your subscription system is not spammed out by bots :)
Post Reply