Email Forms

Status
Not open for further replies.

josuem

Baseband Member
Messages
88
Does anyone know of an easy way to make an email registration form? Its a signup for a newsletter. Right now I don't have access to any programs like DW or MS FP, so keep in mind that I have to code all HTML and any other languages by hand. Actually, I really don't know alot beyond HTML and a little Java. Thanks
 
What do you mean by email registration? Like a mailing list or something? If so, it's pretty easy to do in PHP.
 
Email Form

Well, something along the lines of an email field, name field, and location field. Right now, we just have people emailing us with their info. So, considering i don't know php, would it be easier to leave it at that?
 
So... you want a user to fill out a form and have the fields emailed to you? The easiest way would be PHP. If you know any PHP at all, try here. If not, you might want to try Googling for free form handlers. There are some promising matches here.
 
Thanx alot. Yeah, for now, I'll probably stick to pre-made until i can get enough time to learn PHP. thanx
 
dude, the e mail function in php is the easiest thing ever

just select from database then put it in a while loop till it's e mailed them all

EMILY SAYS: Use the Edit button instead of posting twice in a row. And this post is totally useless too. :(
 
PHP:
<?
	require_once('connect.php');
	$query = "SELECT user_emails FROM tbl_users ORDER BY users_date desc";
	$result = @mysql_query ($query) or die ("failed : ".mysql_error());
	$num = mysql_num_rows ($result) or die ("failed : ".mysql_error());
	if ($num > 0) {
		echo "

There are currently $num user(s) to email to.</p>";	
			if(isset($_POST['mail_form'])) {
		while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
	if($row['0'] && $subject && $message) {
	mail($row['0'], $subject, $message);
}
		}
	}
}
	mysql_free_result ($result);
		} else { 
	echo '

There are no people to send news to, your site sucks.</p>';
		}

	mysql_close();
	?>

<form name="mail" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
	<input type="text" name="subject" />
	<input type="text" name="message" />
	<input type="submit" name="mail_form" value="Mail that news!" />
</form>
I just wrote this out and don't have time or the effort to test it, so ifyou find a few minor bugs just change them, only common sense is needed, just remember to set your classes and include your header and footer tags.

and to register them something like this might work:
PHP:
<?php
if(isset($_POST['register'])) {
if ($usr_mail) {
require_once('connect.php');
$query = "INSERT INTO tbl_users (user_emails) VALUES ('$usr_mail')";
$result = @mysql_query ($query);
if ($result) {
$message = '

You are now on our mailing list, mate.</p>';
} else {
$message = '

You could not be registered for one reason or another, try again later.</p>';
}
}
?>
<form name="register" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="usr_mail" />
<input type="submit" name="register" value="Sign up!">
</form>
once again there may be a few minor bugs, but you don't needmasses of knowledge to edit them out :)

There is also a very easy way with PEAR, but if you wanna know how to use that you'll have to goto PEAR's Website
 
Status
Not open for further replies.
Back
Top Bottom