Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Form not working


  • Please log in to reply
2 replies to this topic

#1 samlf3rd

samlf3rd

  • Members
  • 72 posts
  • OFFLINE
  •  
  • Local time:11:20 AM

Posted 17 June 2010 - 09:37 PM

Hello Bleeping Computer,
I am building a web site that needs a few forms. When you click the send button nothing happens at all. There are two pages of code-the "get a quote" page that contains the form elements and javascript at the bottom. The the PHP code, I will list them below:

THE HTML CODE:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="Boss Limo of Crown Point Indiana" />
<title>Get a Quote</title>
<link rel="stylesheet" type="text/css" media="screen, print, projection" href="common.css"></link>
<script type="text/javascript" src="ie_noclick.js"></script>

<style type="text/css" media="screen, print, projection">
#quoteform fieldset *:last-child {
margin-bottom: 0;
}

#quoteform fieldset {
border: none;
}

#quoteform p {
margin: 0px;
}

#quoteform {
visibility: visible;
position: absolute;
left: 5px;
top: 480px;
z-index: 6;
width: 486px;
}

#quotetext {
visibility: visible;
position: absolute;
left: 27px;
top: 445px;
z-index: 4;
width: 376px;
}

#formarea {
background: url(quotemedia/formarea.gif) no-repeat;
visibility: visible;
position: absolute;
left: 26px;
top: 476px;
z-index: 4;
width: 426px;
height: 204px;
}

</style>
</head>
<body>
<div id="pid3quote">
<div id="flashxmedia"><!--[if IE]>
<script type="text/javascript">sg_ie_no_click_2( '{object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="766" height="327" }{param name="wmode" value="transparent" /} {param name="movie" value="boss/headernew2.swf" /} {param name="quality" value="high" /} {param name="LOOP" value="false" /}{/object}');</script> <![endif]-->
<!--[if !IE]> <-->
<object type="application/x-shockwave-flash" data="boss/headernew2.swf" width="766" height="327"><param name="wmode" value="transparent" /><param name="quality" value="high" /><param name="movie" value="boss/headernew2.swf" /> <param name="LOOP" value="false" /> </object>
<!-- <![endif]--></div>
<div id="backgroundcopy"></div>
<div id="layer0"></div>
<div id="layer19copy"></div>
<div id="callnow2196619576"></div>
<div id="backgroundgraphic"></div>
<div id="id27layer22copy"></div>
<div id="quotehead"></div>
<div id="id82news"></div>
<div id="id32topbar"></div>
<div id="quotetext">
<p>Fill out the following form and you will be contacted shortly.</p>
</div>
<div id="bluetextcopy2">
<p>Our chauffeured limousines are equipped with state-of-the-art communication devices and satellite tracking system for immediate response. All vehicles are meticulously maintained, licensed by the state of Indiana and fully insured.</p>
</div>
<div id="formarea"></div>
<div id="quoteform">
<form name="frmquoteform" action="contact_process.php" align="" method="post">
<div>
<fieldset>
<div><label for="name">Name</label>
<input class="inputc" name="name" id="name" size="19" />
<input type="hidden" name="block_spam_bots" value="1">
</div>
<div><label for="email">Email</label>
<input class="inputc" name="email" id="email" size="19" />
</div>
<div><label for="phone">Phone</label>
<input class="inputc" name="phone" id="phone" size="19" />
</div>
<div><label for="date">Date</label>
<input class="inputc" select id="date" name="date">
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
</div>
<div><label for="howmanypeople">How many people?</label>
<input class="inputc" select id="howmanypeople" name="howmanypeople">
<option value="3-5">3-5</option>
<option value="5-10">5-10</option>
<option value="10-15">10-15</option>
<option value="15-20">15-20</option>
</select>
</div>
<div><label for="whereareyougoing">Where are you going?</label>
<input class="inputc" name="whereareyougoing" id="whereareyougoing" size="19" />
</div>
<div><label for="whereisthepickuplocation">Where is the pick-up location?</label>
<input class="inputc" name="whereisthepickuplocation" id="whereisthepickuplocation" size="19" />
</div>
<div><label for="howlongwillyouneedthevehicle">How long will you need the vehicle?</label>
<input class="inputc" select id="howlongwillyouneedthevehicle" name="howlongwillyouneedthevehicle">
<option value="1-4 hrs.">1-4 hrs.</option>
<option value="4-8 hrs.">4-8 hrs.</option>
<option value="8+">8+</option>
</select>
</div>
<div class="centerac"><input type="button" class="button"
value="Send" name="B1" onclick="java script:validateForm()" /></div>
</fieldset>
</div>
</form>
</div>
<div id="id38layer40"></div>
<div id="layer27"></div>
<div id="layer26"></div>
<div id="liparigraphics2009privacypolicy">
<p>Lipari Graphics &copy; 2009 | <span style="color:#0062AD; text-decoration:underline;">Privacy Policy</span></p>
</div>
<div id="allrightsreserved">
<p>All Rights Reserved <span class="centerac"></span></p>
</div>
<div id="layer30"></div>
</div>
<script language="JavaScript"><!--
function validateForm()
{
var okSoFar=true
with (document.phpformmailer)
{
var foundAt = email.value.indexOf("@",0)
if (foundAt < 1 && okSoFar)
{
okSoFar = false
alert ("Please enter a valid email address.")
email.focus()
}
var e1 = email.value
var e2 = email2.value
if (!(e1==e2) && okSoFar)
{
okSoFar = false
alert ("Email addresses you entered do not match. Please re-enter.")
email.focus()
}
if (thesubject.value=="" && okSoFar)
{
okSoFar=false
alert("Please enter the subject.")
thesubject.focus()
}
if (themessage.value=="" && okSoFar)
{
okSoFar=false
alert("Please enter the details for your enquiry.")
themessage.focus()
}
if (okSoFar==true)
{
block_spam_bots.value=4*3;//spam bots currently can not read JavaScript, if could then they'd fail the maths!
submit(); // do check for updatea often at: www.TheDemoSite.co.uk
}
}
}
// --></script>
</body>
</html>



The PHP CODE:



<?php
/* PHP Form Mailer - easy, secure form mail:
phpFormMailer v2.6

last updated 2nd Dec 2009 - check back often for updates!
(easy to use and more secure than many cgi form mailers) FREE from:

www.TheDemoSite.co.uk

Should work fine on most Unix/Linux platforms
for a Windows version see: asp.thedemosite.co.uk
*/

// ------- three variables you MUST change below -------------------------------------------------------
$replyemail="info@pagepopwebdesign.com"; //change to your email address
$valid_ref1="http://www.pagepopwebdesign.com"; //chamge to your domain name
$valid_ref2="http://www.bosslimocp.com"; //chamge to your domain name

// -------- No changes required below here -------------------------------------------------------------
//
// email variable not set - load $valid_ref1 page
if (!isset($_POST['email']))
{
echo "<script language=\"JavaScript\"><!--\n ";
echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
exit;
}
$ref_page=$_SERVER["HTTP_REFERER"];
$valid_referrer=0;
if($ref_page==$valid_ref1) $valid_referrer=1;
elseif($ref_page==$valid_ref2) $valid_referrer=1;
if((!$valid_referrer) OR ($_POST["block_spam_bots"]!=12))//you can change this but remember to change it in the contact form too
{
echo '<h2>ERROR - not sent.';
if (file_exists("debug.flag")) echo '<hr>"$valid_ref1" and "$valid_ref2" are incorrect within the file:<br>
contact_process.php <br><br>On your system these should be set to: <blockquote>
$valid_ref1="'.str_replace("www.","",$ref_page).'"; <br>
$valid_ref2="'.$ref_page.'";
</blockquote></h2>Copy and paste the two lines above
into the file: contact_process.php <br> (replacing the existing variables and settings)';
exit;
}

//check user input for possible header injection attempts!
function is_forbidden($str,$check_all_patterns = true)
{
$patterns[0] = '/content-type:/';
$patterns[1] = '/mime-version/';
$patterns[2] = '/multipart/';
$patterns[3] = '/Content-Transfer-Encoding/';
$patterns[4] = '/to:/';
$patterns[5] = '/cc:/';
$patterns[6] = '/bcc:/';
$forbidden = 0;
for ($i=0; $i<count($patterns); $i++)
{
$forbidden = preg_match($patterns[$i], strtolower($str));
if ($forbidden) break;
}
//check for line breaks if checking all patterns
if ($check_all_patterns AND !$forbidden) $forbidden = preg_match("/(%0a|%0d|\\n+|\\r+)/i", $str);
if ($forbidden)
{
echo "<font color=red><center><h3>STOP! Message not sent.</font></h3><br><b>
The text you entered is forbidden, it includes one or more of the following:
<br><textarea rows=9 cols=25>";
foreach ($patterns as $key => $value) echo trim($value,"/")."\n";
echo "\\n\n\\r</textarea><br>Click back on your browser, remove the above characters and try again.
</b><br><br><br><br>Thankfully protected by phpFormMailer freely available from:
<a href=\"http://thedemosite.co.uk/phpformmailer/\">http://thedemosite.co.uk/phpformmailer/</a>";
exit();
}
}

foreach ($_REQUEST as $key => $value) //check all input
{
if ($key == "themessage") is_forbidden($value, false); //check input except for line breaks
else is_forbidden($value);//check all
}

$name = $_POST["name"];
$email = $_POST["email"];
$thesubject = $_POST["thesubject"];
$themessage = $_POST["themessage"];
$phone = $_POST["phone"];
$date = $_POST["date"];
$howmanypeople = $_POST["howmanypeople"];
$whereareyougoing = $_POST["whereareyougoing"];
$whereisthepickuplocation = $_POST["whereisthepickuplocation"];
$howlongwillyouneedthevehicle = $_POST["howlongwillyouneedthevehicle"];

$success_sent_msg='<p align="center"><strong>&nbsp;</strong></p>
<p align="center"><strong>Your message has been successfully sent to Boss Limo<br>
</strong> and we will reply as soon as possible.</p>
<p align="center">A copy of your query has been sent to you.</p>
<p align="center">Thank you for contacting us.</p>';

$replymessage = "Hi $name

Thank you for your email.

We will endeavour to reply to you shortly.

Please DO NOT reply to this email.

Below is a copy of the message you submitted:
--------------------------------------------------
Subject: $thesubject
Query:
$themessage
--------------------------------------------------

Thank you";

$themessage = "name: $name \nQuery: $themessage";
mail("$replyemail",
"$thesubject",
"$themessage",
"From: $email\nReply-To: $email");
mail("$email",
"Receipt: $thesubject",
"$replymessage",
"From: $replyemail\nReply-To: $replyemail");
echo $success_sent_msg;
/*
PHP Form Mailer - phpFormMailer (easy to use and more secure than many cgi form mailers)
FREE from:

www.TheDemoSite.co.uk */
?>





If anyone can help I would appreciate it!

BC AdBot (Login to Remove)

 


#2 GigsD4X

GigsD4X

  • Members
  • 6 posts
  • OFFLINE
  •  
  • Local time:07:20 AM

Posted 22 June 2010 - 09:31 PM

Alright here's the problem.

<input type="button" class="button" 
value="Send" name="B1" onclick="java script:validateForm()" />

You need to join the words java and script. Like this:

<INPUT type="button" class="button" value="Send" name="B1" onclick="java script:validateForm();">

Edited by GigsD4X, 22 June 2010 - 09:44 PM.


#3 GigsD4X

GigsD4X

  • Members
  • 6 posts
  • OFFLINE
  •  
  • Local time:07:20 AM

Posted 22 June 2010 - 09:43 PM

SORRY! I tried to fix that, but there was a glitch and I couldn't.

HERE'S THE CORRECT CODE!
<INPUT type="button" class="button" value="Send" name="B1" onclick="validateForm();">





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users