Time frame to purchase
{/code}
JavaScript Code:
{code type=JavaScript}
function displayContactMethod()
{
var id = ‘phone’;
var contatMethod = document.contact_form.contact_method.value;
if(contatMethod == “Phone”)
{
displayDiv(‘phoneNoDiv’)
}
else
{
hideDiv(‘phoneNoDiv’);
document.contact_form.phone.value = ”;
}
}
function initialHiddenDivs()
{
var divID_1 = ‘phoneNoDiv’;
var divID_2 = ‘formRowForum’;
var divID_3 = ‘formRowDatabase’;
var divID_4 = ‘formRowUsers’;
var divID_5 = ‘formRowProvider’;
var divID_6 = ‘formRowCurrentSpecs’;
hideDiv(divID_1);
hideDiv(divID_2);
hideDiv(divID_3);
hideDiv(divID_4);
hideDiv(divID_5);
hideDiv(divID_6);
}
function hideDiv(id)
{
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.display = ‘none’;
}
else {
if (document.layers) { // Netscape 4
document.id.display = ‘none’;
}
else { // IE 4
document.all.id.style.display = ‘none’;
}
}
}
function displayDiv(id)
{
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.display = ‘block’;
}
else {
if (document.layers) { // Netscape 4
document.id.display = ‘block’;
}
else { // IE 4
document.all.id.style.display = ‘block’;
}
}
}
function controlServerHostOptions()
{
var host_vb = document.contact_form.host_vb.value;
if(host_vb == “Yes”)
{
displayDiv(‘formRowForum’);
displayDiv(‘formRowDatabase’);
displayDiv(‘formRowUsers’);
}
else
{
hideDiv(‘formRowForum’);
hideDiv(‘formRowDatabase’);
hideDiv(‘formRowUsers’);
document.contact_form.forum_link.value = ”;
document.contact_form.size.value = ”;
document.contact_form.users.value = ”;
}
}
function controlCurrentHostOptions()
{
var server = document.contact_form.server.value;
if(server == “Yes”)
{
displayDiv(‘formRowProvider’);
displayDiv(‘formRowCurrentSpecs’);
}
else
{
hideDiv(‘formRowProvider’);
hideDiv(‘formRowCurrentSpecs’);
document.contact_form.current_provider.value = ”;
document.contact_form.current_specs.value = ”;
}
}
{/code}
PHP Code:
{code type=PHP}
if($_POST)
{
$name = trim($_POST['name']);
$email = trim($_POST['email']);
$contact_method = trim($_POST['contact_method']);
$phone = trim($_POST['phone']);
$host_vb = trim($_POST['host_vb']);
$forum_link = trim($_POST['forum_link']);
$size = trim($_POST['size']);
$users = trim($_POST['users']);
$server = trim($_POST['server']);
$current_provider = trim($_POST['current_provider']);
$current_specs = trim($_POST['current_specs']);
$specs = trim($_POST['specs']);
$time = trim($_POST['time']);
$budget = trim($_POST['budget']);
$total = trim($_POST['total']);
$_SESSION['name'] = $name;
$_SESSION['email'] = $email;
$_SESSION['contact_method'] = $contact_method;
$_SESSION['phone'] = $phone;
$_SESSION['host_vb'] = $host_vb;
$_SESSION['forum_link'] = $forum_link;
$_SESSION['size'] = $size;
$_SESSION['users'] = $users;
$_SESSION['server'] = $server;
$_SESSION['current_provider'] = $current_provider;
$_SESSION['current_specs'] = $current_specs;
$_SESSION['specs'] = $specs;
$_SESSION['time'] = $time;
$_SESSION['budget'] = $budget;
if($total != 13)
{
echo '
Anti Spam Question is wrong!
Please sum up and type the current result of: 5+5+3=?
‘;
}
else
{
$emailBody = ”;
if(!empty($name))
{
$emailBody .= ‘Name : ‘ . $name . chr(10);
}
if(!empty($email))
{
$emailBody .= ‘Email : ‘ . $email . chr(10);
}
if(!empty($contact_method))
{
$emailBody .= ‘Best method to contact you : ‘ . $contact_method . chr(10);
}
if(!empty($phone))
{
$emailBody .= ‘Phone : ‘ . $phone . chr(10);
}
if(!empty($host_vb))
{
$emailBody .= ‘Will this server host a vBulletin site? : ‘ . $host_vb . chr(10);
}
if(!empty($forum_link))
{
$emailBody .= ‘Forum Link : ‘ . $forum_link . chr(10);
}
if(!empty($size))
{
$emailBody .= ‘Current size of database : ‘ . $size . chr(10);
}
if(!empty($users))
{
$emailBody .= ‘Average concurrent users : ‘ . $users . chr(10);
}
if(!empty($server))
{
$emailBody .= ‘Do you currently have a dedicated server? : ‘ . $server . chr(10);
}
if(!empty($current_provider))
{
$emailBody .= ‘Current Provider : ‘ . $current_provider . chr(10);
}
if(!empty($current_specs))
{
$emailBody .= ‘Current Server Specs : ‘ . $current_specs . chr(10);
}
if(!empty($specs))
{
$emailBody .= ‘Are there any specs you must have with your
new server or additional notes you would
like us to consider? : ‘ . $specs . chr(10);
}
if(!empty($time))
{
$emailBody .= ‘Time frame to purchase : ‘ . $time . chr(10);
}
if(!empty($budget))
{
$emailBody .= ‘Do you have a budget we need to consider? : ‘ . $budget . chr(10);
}
include_once(‘php5Mailer/class.phpmailer.php’);
$mail = new PHPMailer();
$body = $emailBody;
$body = eregi_replace(“[\]“,”,$body);
$subject = eregi_replace(“[\]“,”,$subject);
$mail->From = $email;
$mail->FromName = $name;
$mail->Subject = “New Email from $name ($email)”;
// optional, comment out and test
$mail->AltBody = “To view the message, please use an HTML compatible email viewer!”;
$mail->Body = nl2br($body);
$mail->AddAddress(“todd@urljet.com”, “Todd”);
$mail->IsHTML(true);
if(!$mail->Send())
{
echo ‘
Failed to send mail
‘;
}
else
{
echo ‘
Mail sent
‘;
$_SESSION['name'] = ”;
$_SESSION['email'] = ”;
$_SESSION['contact_method'] = ”;
$_SESSION['phone'] = ”;
$_SESSION['host_vb'] = ”;
$_SESSION['forum_link'] = ”;
$_SESSION['size'] = ”;
$_SESSION['users'] = ”;
$_SESSION['server'] = ”;
$_SESSION['current_provider'] = ”;
$_SESSION['current_specs'] = ”;
$_SESSION['specs'] = ”;
$_SESSION['time'] = ”;
$_SESSION['budget'] = ”;
}
}
}
?>
{/code}
Once again I would like to remind you that you first download this small script from the above download link and take a look at the whole script.
That is all for now, Dude!
Thank you for reading.