Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Form not working

Featured Replies

I have got a PHP script that webdesigner wrote. I have tweaked it so that it has the fields etc that I need to send to the client. That bits easy, but now when you click on the "submit" button it doesn't send and there is no javascript alert.

 

It is linked to another quote page.

 

I enclose both pages so you can look and hopefully help me sort this out

 

Regards,

Junior

 

First Page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
<head>  

       <title>McCallum Window Cleaning - Rawdon, Yeadon, Guiseley</title>  

       <meta name="author" content="Philip Broadhead" />  
       <meta name="description" content="" />  
       <meta name="keywords" content="" />  

       <link href="css/main.css" type="text/css" rel="stylesheet" />  


</head>  
<body>  
<div id="wrapper">  

<div id="name">  
<img src="images/head.png" alt="McCallum Window Cleaning Services, Rawdon" />  
</div>  

<div id="logo">  
<?php include('logo.inc'); ?>  
</div>  

<div id="menu">  
 <?php include('menu.inc'); ?>
</div>  

<div id="form">  
<h3>Please indicate how many and which types of windows
you have require us to clean:</h3>
<div id="center">
<form method="post" name="orderForm" action="total.php">  
<table border="0" cellpadding="5" cellspacing="0">
<tr><th>Type of Window</th><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th></tr>
<tr><td colspan="6"></td></tr>
<tr>
<td>Very Small Window:</td>
<td><input type="checkbox" name="window11" size="3" value="0.00" /></td>
<td><input type="checkbox" name="window12" size="3" value="0.00" /></td>
<td><input type="checkbox" name="window13" size="3" value="0.00" /></td>
<td><input type="checkbox" name="window14" size="3" value="0.00" /></td>
<td><input type="checkbox" name="window15" size="3" value="0.00" /></td>
</tr>  

<tr>
<td>Small Window:</td>
<td><input type="checkbox" name="window21" size="3" value="0.50" /></td>  
<td><input type="checkbox" name="window22" size="3" value="1.00" /></td>
<td><input type="checkbox" name="window23" size="3" value="1.50" /></td>
<td><input type="checkbox" name="window24" size="3" value="2.00" /></td>
<td><input type="checkbox" name="window25" size="3" value="2.50" /></td>
</tr>

<tr>
<td>Medium Window:</td>
<td><input type="checkbox" name="window31" size="3" value="1.00" /></td>
<td><input type="checkbox" name="window32" size="3" value="2.00" /></td>
<td><input type="checkbox" name="window33" size="3" value="3.00" /></td>
<td><input type="checkbox" name="window34" size="3" value="4.00" /></td>
<td><input type="checkbox" name="window35" size="3" value="5.00" /></td>
</tr>  

<tr>
<td>Large Window:</td>
<td><input type="checkbox" name="window41" size="3" value="2.00" /></td>
<td><input type="checkbox" name="window42" size="3" value="4.00" /></td>
<td><input type="checkbox" name="window43" size="3" value="6.00" /></td>
<td><input type="checkbox" name="window44" size="3" value="8.00" /></td>
<td><input type="checkbox" name="window45" size="3" value="10.00" /></td>
</tr>

<tr>
<td>Small Conservatory:</td>
<td><input type="checkbox" name="window51" size="3" value="2.00" /></td>
<td><input type="checkbox" name="window52" size="3" value="4.00" /></td>
<td><input type="checkbox" name="window53" size="3" value="6.00" /></td>
<td><input type="checkbox" name="window54" size="3" value="8.00" /></td>
<td><input type="checkbox" name="window55" size="3" value="10.00" /></td>
</tr>  

<tr>
<td>Large Conservatory:</td>
<td><input type="checkbox" name="window61" size="3" value="4.00" /></td>
<td><input type="checkbox" name="window62" size="3" value="8.00" /></td>
<td><input type="checkbox" name="window63" size="3" value="12.00" /></td>
<td><input type="checkbox" name="window64" size="3" value="16.00" /></td>
<td><input type="checkbox" name="window65" size="3" value="20.00" /></td>
</tr>  

<tr>
<td>Patio Doors:</td>
<td><input type="checkbox" name="window71" size="3" value="0.50" /></td>
<td><input type="checkbox" name="window72" size="3" value="1.00" /></td>
<td><input type="checkbox" name="window73" size="3" value="1.50" /></td>
<td><input type="checkbox" name="window74" size="3" value="2.00" /></td>
<td><input type="checkbox" name="window75" size="3" value="2.50" /></td>
</tr>  

</table>  
<p></p>
<button type="submit" name="quote"><img src="images/view.png" alt="get your quote"></button>  
</form>  
</div>
</div>  
</div>  
</body>  
</html>

Second Page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
<head>  
       <title>McCallum Window Cleaning - Rawdon, Yeadon, Guiseley</title>  

       <meta name="author" content="Philip Broadhead" />  
       <meta name="description" content="" />  
       <meta name="keywords" content="" />  

       <link href="css/main.css" type="text/css" rel="stylesheet" />  




</head>  
<body>  
<div id="wrapper">  

<div id="name">  
	<img src="images/head.png" alt="McCallum Window Cleaning Services, Rawdon" />  
</div>  

<div id="logo">  
	<?php include('logo.inc'); ?>  
</div>  

<div id="menu">  
 		<?php include('menu.inc'); ?>
</div>  

<div id="form">

<h2>Your total quote is <?php echo "£".number_format($total, 2, '.', ','); ?></h2>

<form method="get" name="submitForm" action="">  
<?php
$your_email = "info@philipbroadhead.org";
$website = "McCallum Window Cleaning | Quote";
//BOTS TO BLOCK
$bots = "/(Indy|Blaiz|Java|libwww-perl|Python|OutfoxBot|User-Agent|PycURL|AlphaServer|T8Abot|Syntryx|WinHttp|WebBandit|nicebot)/i";
//Check if known bot is visiting
if (preg_match($bots, $_SERVER["HTTP_USER_AGENT"])) {
exit ("Sorry bots are not allowed here!");
}

//Known Exploits

$exploits = "/(content-type|bcc:|cc:|from:|reply-to:|javascript|onclick|onload)/i";

//Spam words
$spam_words = "/(viagra|poker|blackjack|porn|sex)/i";

// BAD WORDS
$words = "/(
bitch|dick|pussy|pussies|ass|****|cum|cumshot|cum shot|
gangbang|gang bang|god dammit|goddammit|viagra|anus|analsex
)/i";
//BAD WORD/SPAM WORD/EXPLOIT BLOCKER
function wordBlock($word) {
 //Make variables global
global $words;
global $exploits;
global $spam_words;

if (preg_match($words, $word)) {
 $word = preg_replace($words, "#####", $word);
}
if(preg_match($exploits,$word)){
$word = preg_replace($exploits,"",$word);
}
if(preg_match($spam_words,$word)){
 $word = preg_replace($spam_words,"$$$$",$word);
}
return $word;
}
//CLean data function
function dataClean($data) {
$data = stripslashes(trim(rawurldecode(strip_tags($data))));
return $data;
}
//CREATE MAIN VARIABLES
$name = (isset ($_POST['name'])) ? dataClean($_POST['name']) : FALSE;
$number = (isset ($_POST['number'])) ? dataClean($_POST['number']) : FALSE;
$address = (isset ($_POST['message'])) ? wordBlock(dataClean($_POST['message'])) : FALSE;
$total = (isset ($_POST['total'])) ? dataClean($_POST['total']) : FALSE;

/*  
WINDOWS START  
*/  

$window11 = (isset ($_POST['window11'])) ? dataClean($_POST['window11']) : FALSE;
$window12 = (isset ($_POST['window12'])) ? dataClean($_POST['window12']) : FALSE;
$window13 = (isset ($_POST['window13'])) ? dataClean($_POST['window13']) : FALSE;
$window14 = (isset ($_POST['window14'])) ? dataClean($_POST['window14']) : FALSE;
$window15 = (isset ($_POST['window15'])) ? dataClean($_POST['window15']) : FALSE;
$window21 = (isset ($_POST['window21'])) ? dataClean($_POST['window21']) : FALSE;  
$window22 = (isset ($_POST['window22'])) ? dataClean($_POST['window22']) : FALSE;  
$window23 = (isset ($_POST['window23'])) ? dataClean($_POST['window23']) : FALSE;  
$window24 = (isset ($_POST['window24'])) ? dataClean($_POST['window24']) : FALSE;  
$window25 = (isset ($_POST['window25'])) ? dataClean($_POST['window25']) : FALSE;  
$window31 = (isset ($_POST['window31'])) ? dataClean($_POST['window31']) : FALSE;  
$window32 = (isset ($_POST['window32'])) ? dataClean($_POST['window32']) : FALSE;  
$window33 = (isset ($_POST['window33'])) ? dataClean($_POST['window33']) : FALSE;  
$window34 = (isset ($_POST['window34'])) ? dataClean($_POST['window34']) : FALSE;  
$window35 = (isset ($_POST['window35'])) ? dataClean($_POST['window35']) : FALSE;  
$window41 = (isset ($_POST['window41'])) ? dataClean($_POST['window41']) : FALSE;  
$window42 = (isset ($_POST['window42'])) ? dataClean($_POST['window42']) : FALSE;  
$window43 = (isset ($_POST['window43'])) ? dataClean($_POST['window43']) : FALSE;  
$window44 = (isset ($_POST['window44'])) ? dataClean($_POST['window44']) : FALSE;  
$window45 = (isset ($_POST['window45'])) ? dataClean($_POST['window45']) : FALSE;  
$window51 = (isset ($_POST['window51'])) ? dataClean($_POST['window51']) : FALSE;  
$window52 = (isset ($_POST['window52'])) ? dataClean($_POST['window52']) : FALSE;  
$window53 = (isset ($_POST['window53'])) ? dataClean($_POST['window53']) : FALSE;  
$window54 = (isset ($_POST['window54'])) ? dataClean($_POST['window54']) : FALSE;  
$window55 = (isset ($_POST['window55'])) ? dataClean($_POST['window55']) : FALSE;  
$window61 = (isset ($_POST['window61'])) ? dataClean($_POST['window61']) : FALSE;  
$window62 = (isset ($_POST['window62'])) ? dataClean($_POST['window62']) : FALSE;  
$window63 = (isset ($_POST['window63'])) ? dataClean($_POST['window63']) : FALSE;  
$window64 = (isset ($_POST['window64'])) ? dataClean($_POST['window64']) : FALSE;  
$window65 = (isset ($_POST['window65'])) ? dataClean($_POST['window65']) : FALSE;  
$window71 = (isset ($_POST['window71'])) ? dataClean($_POST['window71']) : FALSE;  
$window72 = (isset ($_POST['window72'])) ? dataClean($_POST['window72']) : FALSE;  
$window73 = (isset ($_POST['window73'])) ? dataClean($_POST['window73']) : FALSE;  
$window74 = (isset ($_POST['window74'])) ? dataClean($_POST['window74']) : FALSE;  
$window75 = (isset ($_POST['window75'])) ? dataClean($_POST['window75']) : FALSE;  

/*  
ADD UP TOTAL  
*/  
$total = $window11 + $window12 + $window13 + $window14 + $window15 + $window21 + $window22 + $window23 + $window24 + $window25 + $window31 + $window32 + $window33 + $window34 + $window35 + $window41 + $window42 + $window43 + $window44 + $window45 + $window51 + $window52 + $window53 + $window54 + $window55 + $window61 + $window62 + $window63 + $window64 + $window65 + $window71 + $window72 + $window73 + $window74 + $window75;  
/*  
WINDOWS END  
*/  

$submit = (isset ($_POST['send'])) ? TRUE : FALSE;
$ip = $_SERVER["REMOTE_ADDR"];
$errors = array();
//Check if send button was clicked
if ($submit) {
if (!$name) {
 $errors[] = "Please enter a name!";
}
if ($name) {
 if (!ereg("^[A-Za-z' -]*$", $name)) {
  $errors[] = "You may not use special characters in the name field!";
 }
}
}
if (!$number) {
 $errors[] = "Please enter a telephone number!";
}
if (!$address) {
 $errors[] = "Please provide an address!";
}

//Check if any errors are present
if (count($errors) > 0) {
 foreach ($errors AS $error) {
  print "• $error <br />";
 }
}
else {
//MESSAGE TO SEND TO ADMIN
//Create main headers
 $headers = "From: " . $website . " <$your_email> \n";
 $headers .= "Reply-to:" . $email . " \n";
 $headers .= "MIME-Version: 1.0\n";
 $headers .= "Content-Transfer-Encoding: 8bit\n";
 $headers .= "Content-Type: text/html; charset=UTF-8\n";
 $message = "";
 $message .= "<h1>New E-Mail From " . $website . "</h1><br /><br />";
 $message .= "<b>Senders IP:</b>" . $ip . "<br />";
 $message .= "<b>Senders Name:</b>" . $name . "<br />";
 $message .= "<b>Senders Number:</b>" . $number . "<br />";
 $message .= "<b>Senders Address:</b>" . $address . "<br />";
 $message .= "<b>Senders Quote:</b>" . $total . "<br />";

//E-mails subject
 $mail_subject = "New E-mail From " . $website . "";
/*
CHECK TO BE SURE FIRST E-MAIL TO ADMIN IS A SUCCESS AND SEND EMAIL TO ADMIN
OTHERWISE DON'T SEND AUTO RESPONCE
*/
 if (mail($your_email, $mail_subject, $message, $headers)) {
//UNSET ALL VARIABLES
  unset ($name, $email, $subject, $reason, $comment, $ip, $_REQUEST);
//JAVASCRIPT SUCCESS MESSAGE
  echo "
  <script type='text/javascript' language='JavaScript'>
  alert('Your message has been sent');
  </script>
  ";
//SUCCESS MESSAGE TO SHOW IF JAVASCRIPT IS DISABLED
  echo "<noscript><p>THANK YOU YOUR MESSAGE HAS BEEN SENT</p></noscript>";
/*
-----------------END MAIL BLOCK FOR SENDING TO ADMIN AND START AUTO RESPONCE SEND-----------------
*/
 }
 else {
  echo "
  <script type='text/javascript' language='JavaScript'>
  alert('Sorry could not send your message');
  </script>
  ";
  echo "<noscript><p style='color:red;'>SORRY COULD NOT SEND YOUR MESSAGE</p></noscript>";
 }
}
?>

<h4>If you wish us to contact you regarding your quote then please fill the form in below and submit your information to us</h4>    
<div id="center">
<table border="0" cellpadding="5" cellspacing="0">  
 <tr>  
   <th align="right">Name:</th>  
   <td><input type="text" name="name" size="25" /></td>  
 </tr>  

<tr>  
<th align="right">Address:</th>  
   <td><textarea cols="20" rows="5" name="address"></textarea></td></tr>  

<tr>  
<th align="right">Telephone Number:</th>  
<td><input type="text" name="number" size="20" /></td></tr>  

<tr><td colspan="2" align="center"><input type="submit" name="submit" value="Send Message" />
</td></tr>
</table>
</form>
</div>
</div>
</div>

</body>  
</html>

Hi Junior,

 

I've just quickly looked at the code so this may be way off, but where you are testing for the setting of the submit button on the second page with the line:

 

$submit = (isset ($_POST['send'])) ? TRUE : FALSE;

 

should you be testing the submit button named "quote" in the first page instead?

 

i.e.

 

$submit = (isset ($_POST['quote'])) ? TRUE : FALSE;

 

 

Regards,

 

Steve

I've had a quick look as well - I would agree with the above....that looks to be the problem - if you hit more issues let us know as there is a lot of code to wade through there.

  • Author

Sorry guys this has still not fixed the problem.

 

When the first page is loaded it's fine, but then the second page loads with the error messages ie fill in the address, number and name forms, plus the quote is at £0.00.

 

regards,

Junior

The other thing you need to look at is the form method on the second page, I think that needs to be 'post' not 'get' and the action needs to be the name of the script which is I assume is 'total.php', see if that works.

 

Steve

Hi Junior

 

It seems you have placed the echo price in the wrong place, if you place it as below then it should work

 

/*  
ADD UP TOTAL  
*/  
$total = $window11 + $window12 + $window13 + $window14 + $window15 + $window21 + $window22 + $window23 + $window24 + $window25 + $window31 + $window32 + $window33 + $window34 + $window35 + $window41 + $window42 + $window43 + $window44 + $window45 + $window51 + $window52 + $window53 + $window54 + $window55 + $window61 + $window62 + $window63 + $window64 + $window65 + $window71 + $window72 + $window73 + $window74 + $window75;  
/*  
WINDOWS END  
*/  
?>
<h2>Your total quote is <?php echo "£".number_format($total, 2, '.', ','); ?></h2>
<?php
$submit = (isset ($_POST['send'])) ? TRUE : FALSE;

 

Just move the <h2> statement to the above position, note I also closed the php and reopened it after the <h2>

  • Author

I have this working now, well nearly.

 

I have changed the second page that actually sends the email etc.

The form is sending etc but the total quote value is coming through the email as 0.

 

Any ideas guys??

 

Thanks in advance

Junior.

 

(updated code)

<body>  
<div id="wrapper">  

<div id="name">  
	<img src="images/head.png" alt="McCallum Window Cleaning Services, Rawdon" />  
</div>  

<div id="logo">  
	<?php include('logo.inc'); ?>  
</div>  

<div id="menu">  
 		<?php include('menu.inc'); ?>
</div>  

<div id="form">

<?php
//FIll out the settings below before using this script
$your_email = "info@philipbroadhead.org";
$website = "McCallum Window Cleaning | Quote";
//BOTS TO BLOCK
$bots = "/(Indy|Blaiz|Java|libwww-perl|Python|OutfoxBot|User-Agent|PycURL|AlphaServer|T8Abot|Syntryx|WinHttp|WebBandit|nicebot)/i";
//Check if known bot is visiting
if (preg_match($bots, $_SERVER["HTTP_USER_AGENT"])) {
exit ("Sorry bots are not allowed here!");
}

//Known Exploits

$exploits = "/(content-type|bcc:|cc:|from:|reply-to:|javascript|onclick|onload)/i";

//Spam words
$spam_words = "/(viagra|poker|blackjack|porn|sex)/i";

// BAD WORDS
$words = "/(
bitch|pussy|pussies|ass|****|cum|cumshot|cum shot|
gangbang|gang bang|god dammit|goddammit|viagra|anus|analsex
)/i";
//BAD WORD/SPAM WORD/EXPLOIT BLOCKER
function wordBlock($word) {
 //Make variables global
global $words;
global $exploits;
global $spam_words;

if (preg_match($words, $word)) {
 $word = preg_replace($words, "#####", $word);
}
if(preg_match($exploits,$word)){
$word = preg_replace($exploits,"",$word);

}
if(preg_match($spam_words,$word)){
 $word = preg_replace($spam_words,"$$$$",$word);
}
return $word;
}
//Clean data function
function dataClean($data) {
$data = stripslashes(trim(rawurldecode(strip_tags($data))));
return $data;
}
//CREATE MAIN VARIABLES
$name = (isset ($_POST['name'])) ? dataClean($_POST['name']) : FALSE;
$email = (isset ($_POST['email'])) ? dataClean($_POST['email']) : FALSE;
$telephone = (isset ($_POST['telephone'])) ? dataClean($_POST['telephone']) : FALSE;
$comment = (isset ($_POST['comment'])) ? wordBlock(dataClean($_POST['comment'])) : FALSE;
$submit = (isset ($_POST['send'])) ? TRUE : FALSE;
$email_check = "/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/i";
$ip = $_SERVER["REMOTE_ADDR"];
$errors = array();


$window11 = (isset ($_POST['window11'])) ? dataClean($_POST['window11']) : FALSE;
$window12 = (isset ($_POST['window12'])) ? dataClean($_POST['window12']) : FALSE;
$window13 = (isset ($_POST['window13'])) ? dataClean($_POST['window13']) : FALSE;
$window14 = (isset ($_POST['window14'])) ? dataClean($_POST['window14']) : FALSE;
$window15 = (isset ($_POST['window15'])) ? dataClean($_POST['window15']) : FALSE;
$window21 = (isset ($_POST['window21'])) ? dataClean($_POST['window21']) : FALSE;  
$window22 = (isset ($_POST['window22'])) ? dataClean($_POST['window22']) : FALSE;  
$window23 = (isset ($_POST['window23'])) ? dataClean($_POST['window23']) : FALSE;  
$window24 = (isset ($_POST['window24'])) ? dataClean($_POST['window24']) : FALSE;  
$window25 = (isset ($_POST['window25'])) ? dataClean($_POST['window25']) : FALSE;  
$window31 = (isset ($_POST['window31'])) ? dataClean($_POST['window31']) : FALSE;  
$window32 = (isset ($_POST['window32'])) ? dataClean($_POST['window32']) : FALSE;  
$window33 = (isset ($_POST['window33'])) ? dataClean($_POST['window33']) : FALSE;  
$window34 = (isset ($_POST['window34'])) ? dataClean($_POST['window34']) : FALSE;  
$window35 = (isset ($_POST['window35'])) ? dataClean($_POST['window35']) : FALSE;  
$window41 = (isset ($_POST['window41'])) ? dataClean($_POST['window41']) : FALSE;  
$window42 = (isset ($_POST['window42'])) ? dataClean($_POST['window42']) : FALSE;  
$window43 = (isset ($_POST['window43'])) ? dataClean($_POST['window43']) : FALSE;  
$window44 = (isset ($_POST['window44'])) ? dataClean($_POST['window44']) : FALSE;  
$window45 = (isset ($_POST['window45'])) ? dataClean($_POST['window45']) : FALSE;  
$window51 = (isset ($_POST['window51'])) ? dataClean($_POST['window51']) : FALSE;  
$window52 = (isset ($_POST['window52'])) ? dataClean($_POST['window52']) : FALSE;  
$window53 = (isset ($_POST['window53'])) ? dataClean($_POST['window53']) : FALSE;  
$window54 = (isset ($_POST['window54'])) ? dataClean($_POST['window54']) : FALSE;  
$window55 = (isset ($_POST['window55'])) ? dataClean($_POST['window55']) : FALSE;  
$window61 = (isset ($_POST['window61'])) ? dataClean($_POST['window61']) : FALSE;  
$window62 = (isset ($_POST['window62'])) ? dataClean($_POST['window62']) : FALSE;  
$window63 = (isset ($_POST['window63'])) ? dataClean($_POST['window63']) : FALSE;  
$window64 = (isset ($_POST['window64'])) ? dataClean($_POST['window64']) : FALSE;  
$window65 = (isset ($_POST['window65'])) ? dataClean($_POST['window65']) : FALSE;  
$window71 = (isset ($_POST['window71'])) ? dataClean($_POST['window71']) : FALSE;  
$window72 = (isset ($_POST['window72'])) ? dataClean($_POST['window72']) : FALSE;  
$window73 = (isset ($_POST['window73'])) ? dataClean($_POST['window73']) : FALSE;  
$window74 = (isset ($_POST['window74'])) ? dataClean($_POST['window74']) : FALSE;  
$window75 = (isset ($_POST['window75'])) ? dataClean($_POST['window75']) : FALSE;  

$total = $window11 + $window12 + $window13 + $window14 + $window15 + $window21 + $window22 + $window23 + $window24 + $window25 + $window31 + $window32 + $window33 + $window34 + $window35 + $window41 + $window42 + $window43 + $window44 + $window45 + $window51 + $window52 + $window53 + $window54 + $window55 + $window61 + $window62 + $window63 + $window64 + $window65 + $window71 + $window72 + $window73 + $window74 + $window75;

//Check if send button was clicked
if ($submit) {
if (!$name) {
 $errors[] = "Please enter a name!";
}
if ($name) {
 if (!ereg("^[A-Za-z' -]*$", $name)) {
  $errors[] = "You may not use special characters in the name field!";
 }
}
if (!$telephone) {
 $errors[] = "Please enter a phone number!";
}
if (!$comment) {
 $errors[] = "Please leave your comments!";
}
//Check if any errors are present
if (count($errors) > 0) {
 foreach ($errors AS $error) {
  print "• $error <br />";
 }
}
else {
//MESSAGE TO SEND TO ADMIN
//Create main headers
 $headers = "From: " . $website . " <$your_email> \n";
 $headers .= "Reply-to:" . $email . " \n";
 $headers .= "MIME-Version: 1.0\n";
 $headers .= "Content-Transfer-Encoding: 8bit\n";
 $headers .= "Content-Type: text/html; charset=UTF-8\n";
 $message = "";
 $message .= "<h3>New E-Mail From " . $website . "</h3><br /><br />";
 $message .= "<b>Senders IP:</b>" . $ip . "<br />";
 $message .= "<b>Senders Name:</b>" . $name . "<br />";
 $message .= "<b>Senders Phone Number:</b>" . $telephone . "<br />";
 $message .= "<b>Senders Address:</b>" . $comment . "<br />";
 $message .= "<b>Senders Total Quote:</b>" . $total . "<br />";

//E-mails subject
 $mail_subject = "New E-mail From " . $website . "";
/*
CHECK TO BE SURE FIRST E-MAIL TO ADMIN IS A SUCCESS AND SEND EMAIL TO ADMIN
OTHERWISE DON'T SEND AUTO RESPONCE
*/
 if (mail($your_email, $mail_subject, $message, $headers)) {
//UNSET ALL VARIABLES
  unset ($name, $email, $subject, $reason, $comment, $ip, $_REQUEST);
//JAVASCRIPT SUCCESS MESSAGE
  echo "
  <script type='text/javascript' language='JavaScript'>
  alert('Thank you for the interest. We will be in touch with you soon.');
  </script>
  ";
//SUCCESS MESSAGE TO SHOW IF JAVASCRIPT IS DISABLED
  echo "<noscript><p>THANK YOU YOUR MESSAGE HAS BEEN SENT</p></noscript>";
/*
-----------------END MAIL BLOCK FOR SENDING TO ADMIN AND START AUTO RESPONCE SEND-----------------
*/
 }
 else {
  echo "
  <script type='text/javascript' language='JavaScript'>
  alert('Sorry could not send your message');
  </script>
  ";
  echo "<noscript><p style='color:red;'>SORRY COULD NOT SEND YOUR MESSAGE</p></noscript>";
 }
}
}
?>

<h4>If you wish us to contact you regarding your quote then please fill the form in below and submit your information to us</h4>    
<div id="center">

<form method='POST' action='<?php echo "".$_SERVER['PHP_SELF'].""; ?>'>
<h2>Your total quote is <?php echo "£".number_format($total, 2, '.', ','); ?></h2>

<p>
Your Name<br>
<input type='text' name='name' value='<?php echo "" . $_REQUEST['name'] . "";?>'>
</p>

<p>
Telephone Number<br>
<input type='text' name='telephone' value='<?php echo "" . $_REQUEST['telephone'] . "";?>'>
</p>
<p>
Your Address<br>
<textarea name='comment' rows='4' cols='30' ><?php echo "" . $_REQUEST['comment'] . "";?></textarea>
</p>
<p>
<input type='submit' name='send' value='Send message'>
</p>
</form>


</div>
</div>
</div>

</body>  
</html>

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.