Jump to content

Need some help.


Toggles

Recommended Posts

Hello, I'm making a website for my CS clan and I want to make an application page.  My friend told me that requires php.  I want people fill in there information, like Name, In-Game Name, Years Playing, Time Playing in server, and Why you want to join.  So after they fill that in, I would like to it e-mail me and 3 other.  First question is, is that possible to have it e-mail more than one person?  And second, if it is possible could I get some help setting it up?

Thanks in advance

Toggles
Link to comment
Share on other sites

Try something like this:

[code]<?
if (isset($_POST['submit'])) {
// BEGIN - Make the inputs safe
$_POST['name'] = preg_replace('|[^a-zA-Z]|', '', $_POST['name']);
$_POST['age'] = preg_replace('|[^0-9]|', '', $_POST['age']);
$_POST['email'] = preg_replace('|[^a-zA-Z0-9.@]|', '', $_POST['email']);

// Run some checks
if (empty($_POST['name'])) {
echo "Sorry, but you cannot leave your name blank";
} else if (empty($_POST['age'])) {
echo "sorry, but you cannot leave your age blank";
} else if (empty($_POST['email'])) {
echo "Sorry, but you cannot leave your e-mail blank";
} else if (strpos($_POST['email'], "@") === FALSE || strpos($_POST['email'], ".") === FALSE) {
echo "Sorry, but you must enter a valid e-mail.";
} else {
// Notify the user that they have applied
echo "You have successfully applied to our clan, thank you.";

// Send notification to the clan leaders
$subject = "YOUR CLAN NAME: Player Application";
$message = "Dear Clan leader,<br />You have just had a new player apply to your clan with the following information:
<br /><b>Name:</b> ".$_POST['name']."
<br /><b>Age:</b> ".$_POST['age']."
<br /><b>E-Mail:</b> ".$_POST['email'];

$headers  = 'MIME-Version: 1.0'."\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
$headers .= "From: mail@YOURDOMAIN.com";
mail("email1@YOURDOMAIN.com, email2@YOURDOMAIN.com, email3@YOURDOMAIN.com", $subject, $message, $headers);
}
} else {
?>
<form action="<?= $_SERVER['PHP_SELF']; ?>" method="post" name="apply">
<input name="name" type="text" />
<input name="age" type="text" />
<input name="email" type="text" />
<input name="submit" type="submit" value="Submit" />
</form>
<?
}
?>[/code]
Link to comment
Share on other sites

Nope 8) - You don't need mySQL for this.

EDIT: You need to make a new page named something like, 'apply.php' and put the information in that page.

If you've done that and you are still only seeing a bunch of text, that means your server doesn't have PHP installed.
Link to comment
Share on other sites

How would I get my current template on that page?  I was to lazy to make one, so I downloaded one for now until I get more time to make one.

*Edit* Nevermind figured out how, just saved that template as a .php and added that text, I openned it in my browser and got this.

[IMG]http://i19.photobucket.com/albums/b193/toggles/apply.jpg[/img]
Link to comment
Share on other sites

You need to change the e-mails to real e-mails, edit the following text snippets.
[b]E-Mail that it comes from:[/b]
[code]From: mail@YOURDOMAIN.com[/code]

[b]E-Mail to send to:[/b]
[code]email1@YOURDOMAIN.com
email2@YOURDOMAIN.com
email3@YOURDOMAIN.com[/code]

Forgot to mention, your server (PHP) also needs to support the mail() function.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.