php 1

New customers and PHP 1


 <script>
    // This line generates a random number either 0 or 1
    var charand = Math.ceil(Math.random() * 2);
    
    // this line creates a text array where useThis[0] is first and useThis[1] is last
    // that is used in the prompt for data entry based on the value of charand    
    var useThis = ["first", "last"];
    
    </script>
<!-- These are in-line styles. You can change the look of all the relevant items at once simply by changing it here -->
<style>
    p.redPara    {
        color:            #FF0000;
        font-family:     Verdana;
        font-style:     italic;
        font-size:         14px;
        font-weight:     bold;
    }
    
    p.normal    {
        color:            #000000;
        font-family:     Verdana;
        font-size:         14px;
        font-style:     normal;
        }
    
    p.pageNotes    {
        color:            #000000;
        font-family:     Verdana;
        font-size:         14px;
        font-style:     normal;
    
        }

    .pageNotesCentre    {
        color:            #666666;
        font-family:     Verdana;
        font-size:         14px;
        font-style:     normal;
        text-align:        left;
        margin-top:     5px;
        margin-bottom:     20px;
           width:             200px;
        }
    
    div.InputBlock {
        display: inline-block;
        vertical-align: top;
        padding-top:     7px;
          padding-right:     10px;
          padding-bottom: 10px;
          padding-left:     10px;
        /*border: solid black 0.5px;*/
        }
    div.question    {
        display:         inline-block;
        vertical-align: top;
        padding-top:     10px;
          padding-right:     10px;
          padding-bottom: 10px;
          padding-left:     10px;
          
        width:             200px;
        
        color:            #000000;
        font-family:     Verdana;
        font-size:         14px;
        font-style:     normal;
        /*border: solid black 0.5px;*/
        }

</style>

<form name="contactform" method="post" autocomplete="off" onSubmit="return Verify(this);" action="php1.php">
<p class="redPara">
   Reminder: You MUST be completing this form
   before <br>6 pm on the day of the gig.
   </p>
<p class="pageNotes">
   <strong> You are asked to pay IN CASH on entry. <br><br>
    Please note once you have paid and entered no refunds will be given under ANY circumstances as we do
    not issue tickets. <br><br>
    This extends to include technical failures, power cuts or members of 
    the band (or audience/you) falling ill mid-performance etc. </strong>
      </p>
   
<p></p>
   
   
<p class="redPara">Sections marked <span class="blk">*</span> must be completed</p>

<div>
    <div class="question">
            First Name *
        </div>
    <div class="InputBlock">
            <input  type="text" name="first_name" maxlength="50" size="30"/>
        </div>
    </div>
<div>
    <div class="question">
            Last Name *
        </div>
    <div class="InputBlock">
            <input  type="text" name="last_name" maxlength="50" size="30"/>
        </div>
    </div>
<div>
    <div class="question">
            <strong><font color="#FF0000">GREAT CARE HERE PLEASE <br>
Name of the band</font> </strong>you are coming to see <br>(ONE BAND PER FORM) *
        </div>
    <div class="InputBlock">
            <input  type="text" name="band" maxlength="60" size="30" autocomplete="off"/>
        </div>
    </div>

<div>
    <div class="question">
            How many tickets do you require? *
        </div>
    <div class="InputBlock">
            <select name="formGender">
                <option value="">Select...</option>
                <option value="1">One</option>
                <option value="2">Two</option>
                <option value="3">Three</option>
                <option value="4">Four</option>
                <option value="5">Five</option>
                <option value="6">Six</option>
                <option value="7">Seven</option>
                <option value="8">Eight</option>
                <option value="9">Nine</option>
                <option value="10">Ten</option>
                <option value="10+">10+ (Use Comments Box)
                </option>
                </select>
        </div>
    </div>

<!--<div>
    <div class="question">
            Do you get our weekly e-mails?
        </div>
    <div class="InputBlock">
            <select name="formMailing">
                <option value="">Select...</option>
                <option value="Yes">Yes</option>
                <option value="No, Please Add Me">No, please add me</option>
                </select>
        </div>
    </div>-->
<div>
    <div class="question">
            Your E-mail Address *
        </div>
    <div class="InputBlock">
            <input  type="text" name="email" maxlength="80" size="30"/>
            <div class="pageNotesCentre">
                Please type with care:<br>
                We will add you to our mailing list.
                </div>
        </div>
    </div>

<div>
    <div class="question">
            Telephone Number
        </div>
    <div class="InputBlock">
            <input  type="text" name="telephone" maxlength="30" size="30"/>
            <div class="pageNotesCentre"><strong>COVID 19 TRACING.</strong> <br>A phone number is required.<br>
                It will never be used for marketing.
                </div>
        </div>
    </div>
<div>
    <div class="question">
            Any comments
        </div>
    <div class="InputBlock">
            <textarea  name="comments" maxlength="1000" cols="25" rows="6">
                </textarea>
        </div>
    </div>

<div>
    <div class="question">
            Your full home address *
        </div>
    <div class="InputBlock">
            <textarea  name="address" maxlength="1000" cols="25" rows="6">
                </textarea>
            <br>
            <div class="pageNotesCentre">Full address required for legal reasons. <br>
            If you do not include your address we may write back and ask for it before
            accepting your booking.<br>
            </div>
        </div>
    </div>

<p class="normal">                
    Please type the <strong><script>document.write(useThis[charand-1])</script></strong> letter of the <br>
    word <strong>Tropic</strong> in the box BELOW
    and then click the Submit button
    </p>
<div>
    <div class="question">
        <input  type="text" name="human" size="10"/>
        </div>
        
    <div class="InputBlock">
        <input type="submit" value="Submit"/>
        </div>
    </div>


<input type="hidden" id="custId" name="custId" value="THIS E-MAIL HAS BEEN SENT TO YOU BY A PERSON AND IS YOUR TICKET CONFIRMATION
You might like to bring a copy of this e-mail to the gig with you, either in print or on a phone.
Please do not write to this e-mail address.
IMPORTANT: To make any changes use the CHANGE AN EXISTING RESERVATION link on the web site at https://www.tropicatruislip.co.uk/change-a-ticket.html
Please do NOT use e-mail to change a ticket also please do NOT try to contact Tropic on Facebook or via Twitter as it will most likely NOT be seen.
Your surname will be on a list on at the door at the venue, please bring CASH and pay when you arrive.
SOME GIGS SELL OUT AND you MUST be in by 9.30 or we reserve the right to release your booking to people who might be waiting for any returns. In this case you might NOT be allowed in.
For address, price, timings etc. go to the web site https://www.tropicatruislip.co.uk or see https://www.tropicatruislip.co.uk/FAQ.html if you have any questions regarding your booking or the venue in general.
Please note we are ostensibly a standing venue. There are a few places to sit but you need to be in early to get them!
Thank you.">

</form>
<SCRIPT>
 
    function Verify(f)        {
        // check the gender
        if (f.formGender.value.length < 1)    {
            alert ("Please select a ticket quantity from the drop down box");
            return false;
   
        }
     
        // check the first name has been entered
        if (f.first_name.value.trim().length < 1)    {
            alert ("You must enter your first name");
            return false;
        }
   
        // check the last name has been completed
        if (f.last_name.value.trim().length < 1)    {
            alert ("You must enter your last name");
            return false;
        }
   
     // check the band name has been completed
        if (f.band.value.trim().length < 1)    {
            alert ("You must enter a band name");
            return false;
        }
     
        // check the email has been completed
        if (f.email.value.trim().length < 1)    {
            alert ("You must enter your email address");
            return false;
        }
     
        // alert(f.address.value.trim().length);
        // check the address has been completed
        if (f.address.value.trim().length < 15)    {
            alert ("You must enter your home address in full");
            return false;
        }
       
        // check the confirmation character
         if (charand == 1 && f.human.value.toUpperCase() != "T" || charand == 2 && f.human.value.toUpperCase() != "C")    {
            alert ("Have you entered the correct letter in the box?");
            return false;
            
        }
        return true;
    }
</SCRIPT>



<?php
//// php1 for NEW CUSTOMER booking form
if(isset($_POST['email'])) {
    // EDIT THE 3 LINES BELOW AS REQUIRED
    $email_to = "newbookings2@tropicatruislip.co.uk";
    $email_subject = "(NC) (No Reply) Manual confirmation of your ticket for Tropic At Ruislip";
    $link_text = '<a href="default.php"><font color="#000099" face="Verdana" size="2">Return to Home Page</font></a><br /><br />';
    echo($link_text);
    
    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }

    // validation expected data exists
    if(!isset($_POST['first_name']) ||
        !isset($_POST['last_name']) ||
        // added this to check for gender
        !isset($_POST['formGender']) ||
        // !isset($_POST['telephone']) ||
        //  !isset($_POST['comments']) ||
//  !isset($_POST['address']) ||
 !isset($_POST['band']) ||
        !isset($_POST['email'])) 
        
        {
        died('We are sorry, but there appears to be a problem with the form you submitted.');
    }
    else    {

        $first_name = $_POST['first_name'];     // required
        $last_name = $_POST['last_name'];         // required
        $email_from = $_POST['email'];             // required
        $telephone = $_POST['telephone'];         // not required
$band = $_POST['band'];         // required
        $comments = $_POST['comments'];         // required
 $address = $_POST['address'];         // required
        $gender = $_POST['formGender'];         // required
$hiddentext = $_POST['custId'];         // required
    
        $error_message = "";
        $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
    
          if(!preg_match($email_exp,$email_from)) {
           // $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
          }
    
        $string_exp = "/^[0-9 A-Za-z .'-]+$/";
    
          if(!preg_match($string_exp,$first_name)) {
              $error_message .= 'The First Name you entered does not appear to be valid.<br />';
          }
    
          if(!preg_match($string_exp,$last_name)) {
            $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
          }
 if(!preg_match($string_exp,$band)) {
            $error_message .= 'The band name you entered does not appear to be valid.<br />';
          }
    
          if(strlen($comments) < 2) {
            $error_message .= 'The Comments you entered do not appear to be valid.<br />';
          }
    
if(strlen($address) < 2) {
            $error_message .= 'The Address you entered does not appear to be valid.<br />';
          }
          if(strlen($error_message) > 0) {
            died($error_message);
          }
    
        $email_message = "Booking details below.\n\n";
    
    
        function clean_string($string) {
          $bad = array("content-type","bcc:","to:","cc:","href");
          return str_replace($bad,"",$string);
        }
    
    
    
        $email_message .= "First Name: ".clean_string($first_name)."\n\n";
        $email_message .= "Last Name: ".clean_string($last_name)."\n\n";
        $email_message .= "Email: ".clean_string($email_from)."\n\n";
        $email_message .= "Telephone: ".clean_string($telephone)."\n\n";
$email_message .= "Band: ".clean_string($band)."\n\n";
 $email_message .= "Ticket Quantity: ".clean_string($gender)."\n\n";
    $email_message .= "Any Comments: ".clean_string($comments)."\n\n";
    $email_message .= "Address: ".clean_string($address)."\n\n";
 $email_message .= "Please Note: ".clean_string($hiddentext)."\n\n\n";
    
    
        // create email headers
        $headers = 'From: '.$email_from."\r\n".
        'Reply-To: '.$email_from."\r\n" .
        'X-Mailer: PHP/' . phpversion();
        @mail($email_to, $email_subject, $email_message, $headers);
        
        // include your own success html here
        echo "Thank you for contacting us.<br />We will be in touch with you very soon.<br /><br />";

        // ---------------------------------------------------------------------
        // REDIRECT
        // ---------------------------------------------------------------------
        
        // enter the full url of the page you want to return to here
        
        $strNewLocation="https://www.tropicatruislip.co.uk/acknowledge-a-booking-new-customer.html";
        
        
        // Note:
        // $_SERVER["SCRIPT_URI"] contains the url of this page
        // if the $strNewLocation is set to this page then don't redirect or it will go into an endless loop - that would be silly
        
        // The if statement checks that they are not the same (force both to lower case just incase!)
        
        if (strtolower($strNewLocation) <> strtolower($_SERVER["SCRIPT_URI"]))    {
        
            echo "<script>\n\r window.location = '" . $strNewLocation . "';\n\r</script>";
            //echo("test");
        }
    }    
}
else
    {
    echo "No parameters were set<br>";
}

?>


Join Our Mailing List

Admit one

To have this blog e-mailed to you each week just join or mailing list from the link below.

Join Our Mailing List