Toggles Posted September 8, 2006 Share Posted September 8, 2006 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 advanceToggles Quote Link to comment Share on other sites More sharing options...
Nhoj Posted September 8, 2006 Share Posted September 8, 2006 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] Quote Link to comment Share on other sites More sharing options...
Toggles Posted September 8, 2006 Author Share Posted September 8, 2006 Thank you, I was reading a little about PHP and do I have to have an SQL database? And where do I add that text? I put it in the coding, and it just came up like text on the page. Quote Link to comment Share on other sites More sharing options...
Nhoj Posted September 8, 2006 Share Posted September 8, 2006 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. Quote Link to comment Share on other sites More sharing options...
Toggles Posted September 8, 2006 Author Share Posted September 8, 2006 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] Quote Link to comment Share on other sites More sharing options...
Nhoj Posted September 8, 2006 Share Posted September 8, 2006 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.comemail2@YOURDOMAIN.comemail3@YOURDOMAIN.com[/code]Forgot to mention, your server (PHP) also needs to support the mail() function. Quote Link to comment Share on other sites More sharing options...
Toggles Posted September 8, 2006 Author Share Posted September 8, 2006 So for the From e-mail, I need to make an account that will sent it from? Quote Link to comment Share on other sites More sharing options...
Nhoj Posted September 8, 2006 Share Posted September 8, 2006 Usually you can use the default one set on your server, such as mail@YOURDOMAIN.com, just change the yourdomain.com part. Quote Link to comment Share on other sites More sharing options...
Toggles Posted September 8, 2006 Author Share Posted September 8, 2006 Ok, thanks a lot for your help, I really appreciate it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.