PDA

View Full Version : Can someone make me a email form



GoldenMerc
23-08-2011, 07:03 PM
With the following;

Habbo name
Forum Name
Email
(Dropdown box) What job your applying for
Experiance
Why you want this job

+50 rep
Ross

Shibby-Shabs
24-08-2011, 09:24 AM
Give me a few minutes to install the new version of EasyPHP and I'll get it done for you, I'll use JQuery to make it better :)

Shibby-Shabs
24-08-2011, 10:52 AM
Here we go, sorry for the wait - the code is below and you can preview it at http://jspace.netai.net/email (sending disabled).
form.php:


<html>
<head>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'></script>

<script type='text/javascript'>
// JQuery Start
$(document).ready(function() {

$('#form_button').click(function() {
habboname = $('#form_habbo').val();
forumname = $('#form_forum').val();
email = $('#form_email').val();
job = $('#form_job').val();
xp = $('#form_xp').val();
reason = $('#form_reason').val();

$.post('send_mail.php', {habbo_name: habboname, forum_name: forumname, email: email, job: job, xp: xp, reason: reason}, function(returns) {

if (returns == 'error_empty') {
$('#form_warning').fadeIn(500).html("All fields are required.");
}
else {
$('#form_warning').fadeIn(500).html("Application Sent");
$('#form').fadeOut(500);
}


});

});

});
// JQuery End
</script>
<style>input, textarea {text-align:center;}</style>
</head>
<body>
<center>
<div id='form_warning' style='text-align:center;border: 2px solid #E41B17; background:#F62217; width:30%; height:20px; font-weight:bold;color:#ffffff;display:none;'></div>
<div id='form'>
Habbo Name:<br /> <input type='text' id='form_habbo'> <br />
Forum Name:<br /> <input type='text' id='form_forum'> <br />
Email:<br /> <input type='text' id='form_email'> <br />
What job are you applying for?<br /> <select id='form_job'>
<option value='job1'>Job 1</option>
<option value='job2'>Job 2</option>
</select> <br />
Experience: <br /> <textarea id='form_xp' cols='30' rows='5'></textarea><br />
Why do you want this job? <br /> <textarea id='form_reason' cols='30' rows='5'></textarea><br />
<input type='submit' value='Send' id='form_button'>
</div>
</center>
</body>
</html>


send_mail.php:


<?php
///////////////////////////////////////////////
// Enter your email inside the quotation marks
$to = "[email protected]";
//////////////////////////////////////////////

if (isset($_POST['habbo_name'], $_POST['forum_name'], $_POST['email'], $_POST['job'], $_POST['xp'], $_POST['reason'])) {

$habbo = $_POST['habbo_name'];
$forum = $_POST['forum_name'];
$email = $_POST['email'];
$job = $_POST['job'];
$xp = $_POST['xp'];
$reason = $_POST['reason'];

if (empty($habbo)||empty($forum)||empty($email)||empt y($job)||empty($xp)||empty($reason))
echo "error_empty";
else {
$message = "
Habbo Name: $habbo
Forum Name: $forum
Email: $email
Job they want: $job
Experience: $xp
Why they want the job: $reason
";
mail($to, "Application Form [$job]", $message, "From: Application Form");
}

} else exit();


?>

Sam
24-08-2011, 02:12 PM
If you need it with SMTP Authentication / anything let me know ^^

Sam
24-08-2011, 03:13 PM
Sorry cant edit previous: Here's my quick intake. Didnt bother adding any validations because i take it its only going to certain people but i can if you like. Sloppy coding! This way does it through emailing yourself, from yourself. When the user sends the application, your email sends and email to whatever value is in $youremail (so you can send to a different email if you like). This is the only way i could think of sending the email if your email has SMTP Authentication!



<?php

// Mini Email Script by Sam of HbxF.

include("Mail.php");
if (isset($_POST['submit'])) {

$habboname = $_POST['habboname'];
$forumname = $_POST['forumname'];
$email = $_POST['email'];
$job = $_POST['job'];
$xp = $_POST['xp'];
$why = $_POST['why'];

$myemail ="EMAIL"; // Your Email Here.

//Go ahead and send the email

$from = "Your Name <[email protected]>"; // The email is sent to you from yourself. So insert your name and email here.
$to = $myemail; // Your email
$subject = "Job Application"; // Email Subject
$body = "
You have received an appplication from $habboname, \n

Their email is: $email
Their Forum name is: $forumname
They want the $job job

Experience:

$xp \n
Why you hould hire them:

$why\n\n


"; // The Message


$host = "mail.YOURHOST.com"; // Your SMTP host.
$username1 = "[email protected]"; // Your Username
$password1 = "PASSWORD"; //Password
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username1,
'password' => $password1));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");

}

die ("Application Sent!"); {


}
}
?>
<html>

<head>
<title>Email Script</title>

<form action='mail2.php' method='POST'>
<table>
<tr>
<td>
Habbo Name:
</td>
<td>
<input type='text' name='habboname' value='<?php if (isset($_POST['submit'])) { echo $habboname; } else { } ?>' >
</td>
</tr>
<tr>
<td>
Forum Name:
</td>
<td>
<input type='text' name='forumname' value='<?php if (isset($_POST['submit'])) { echo $forumname; } else { } ?>'>
</td>
</tr>
<tr>
<td>
Email:
</td>
<td>
<input type='text' name='email'>
</td>
</tr>
<tr>
<td>
Which Job are you applying for:
</td>
<td>
<select name="job">
<option value="Job1">Job1</option>
<option value="Job2">Job2</option>
<option value="Job3">Job3</option>
</select>
</td>
</tr>
<tr>
<td>
Your Experience:
</td>
<td>
<input type='text' name='xp'>
</td>
</tr>
<tr>
<td>
Why should we pick you?:
</td>
<td>
<input type='text' name='why'>
</td>
</tr>

</table>
<br/><br/>
<input type="submit" name="submit" value="Send Application">


This is of course assuming your server has the Pear mail addon installed which is probably does. Can setup a quick demo too if needed!

Shibby-Shabs
25-08-2011, 12:00 AM
^
Mmm.. Now I have to learn more secure mail sending, I didn't validate email though I probably should of and know how to :)

QuotePort
25-08-2011, 08:11 PM
If you need a contact form quickly, I used to use Foxy Form. http://www.foxyform.com

I hope that helps!

Want to hide these adverts? Register an account for free!