Hello, i have problem - i need to integrate this code from one project to MODx website Evo 1.06, could you please help me? This a code of another php script and when you booking, link must be like
http://site.com/enquiry?bid=tour1 e.g., so i have a snippet [[enquiry]], but when i click a button "Enquiry this tour" - MODx resend me to main page, when i click second time - send me to enquiry page, but when i fill all fields - nothing happen, or Page not found, help me please, i spent already 3 days about it and can not solved..
Code of form
<?php
include("inc-system.php") ?>
<?
$sent=0;
$warning=0;
$infomsg="";
$enquiryrows="10";
$contactnameinputclass = $inputareabox;
$contactnameinfoimg = "page-info-on.jpg";
$emailaddressinputclass = $inputareabox;
$emailaddressinfoimg = "page-info-on.jpg";
$homephoneinputclass = $inputareabox;
$homephoneinfoimg = "page-info-on.jpg";
$mobilephoneinputclass = $inputareabox;
$mobilephoneinfoimg = "page-info-on.jpg";
$hotelnameinputclass = $inputareabox;
$hotelnameinfoimg = "page-info-on.jpg";
$hotelroominputclass = $inputareabox;
$hotelroominfoimg = "page-info-on.jpg";
$arrivaldateinputclass = $inputareabox;
$arrivaldateinfoimg = "page-info-on.jpg";
$boatnameinputclass = $inputareabox;
$boatnameinfoimg = "page-info-on.jpg";
$privatecharterinputclass = $inputareabox;
$privatecharterinfoimg = "page-info-on.jpg";
$startdateinputclass = $inputareabox;
$startdateinfoimg = "page-info-on.jpg";
$daysrequiredinputclass = $inputareabox;
$daysrequiredinfoimg = "page-info-on.jpg";
$flexibilityinputclass = $inputareabox;
$flexibilityinfoimg = "page-info-on.jpg";
$guestcountinputclass = $inputareabox;
$guestcountinfoimg = "page-info-on.jpg";
$guestdetailsinputclass = $inputareabox;
$guestdetailsinfoimg = "page-info-on.jpg";
$enquiryinputclass = $inputareabox;
$enquiryinfoimg = "page-info-on.jpg";
$antispaminputclass = $inputareabox;
$antispaminfoimg = "page-info-on.jpg";
$action=$_GET['action'];
$pconly=$_GET['pconly'];
if ($action=="submit") {
$contactname = $_POST['contactname'];
$emailaddress = $_POST['emailaddress'];
$homephone = $_POST['homephone'];
$mobilephone = $_POST['mobilephone'];
$hotelname = $_POST['hotelname'];
$hotelroom = $_POST['hotelroom'];
$arrivaldate = $_POST['arrivaldate'];
$boatname = $_POST['boatname'];
$privatecharter = $_POST['privatecharter'];
$startdate = $_POST['startdate'];
$daysrequired = $_POST['daysrequired'];
$flexibilitybefore = $_POST['flexibilitybefore'];
$flexibilityafter = $_POST['flexibilityafter'];
$guestcount = $_POST['guestcount'];
$guestdetails = $_POST['guestdetails'];
$enquiry = $_POST['enquiry'];
$antispam = $_POST['antispam'];
$antispamcode = $_GET['antispamcode'];
$emailok=CheckEmailAddress($emailaddress);
$mandatoryfields=0;
if ($contactname!="") {
$mandatoryfields=$mandatoryfields+1;
} else {
$contactnameinputclass=$inputareaboxmissing;
$contactnameinfoimg="warning-triangle-animated-small.gif";
$contactnameerrflag=1;
}
if ($emailaddress!="" && $emailok==1) {
$mandatoryfields=$mandatoryfields+1;
} else {
$emailaddressinputclass=$inputareaboxmissing;
$emailaddressinfoimg="warning-triangle-animated-small.gif";
$emailaddresserrflag=1;
}
if ($boatname!="") {
$mandatoryfields=$mandatoryfields+1;
} else {
$boatnameinputclass=$inputareaboxmissing;
$boatnameinfoimg="warning-triangle-animated-small.gif";
$boatnameerrflag=1;
}
if ($privatecharter!="") {
$mandatoryfields=$mandatoryfields+1;
} else {
$privatecharterinputclass=$inputareaboxmissing;
$privatecharterinfoimg="warning-triangle-animated-small.gif";
$privatechartererrflag=1;
}
if ($startdate!="") {
$mandatoryfields=$mandatoryfields+1;
} else {
$startdateinputclass=$inputareaboxmissing;
$startdateinfoimg="warning-triangle-animated-small.gif";
$startdateerrflag=1;
}
if ($daysrequired!="") {
$mandatoryfields=$mandatoryfields+1;
} else {
$daysrequiredinputclass=$inputareaboxmissing;
$daysrequiredinfoimg="warning-triangle-animated-small.gif";
$daysrequirederrflag=1;
}
if ($guestcount!="") {
$mandatoryfields=$mandatoryfields+1;
} else {
$guestcountinputclass=$inputareaboxmissing;
$guestcountinfoimg="warning-triangle-animated-small.gif";
$guestcounterrflag=1;
}
// if ($enquiry!="") {
// $mandatoryfields=$mandatoryfields+1;
// } else {
// $enquiryinputclass=$inputareaboxmissing;
// $enquiryinfoimg="warning-triangle-animated-small.gif";
// $enquiryerrflag=1;
// }
if (($antispam!="") && (strtolower($antispam)==strtolower($antispamcode))) {
$mandatoryfields=$mandatoryfields+1;
} else {
$antispaminputclass=$inputareaboxmissing;
$antispaminfoimg="warning-triangle-animated-small.gif";
$antispamerrflag=1;
}
if ($mandatoryfields==8) {
// Send the message to website owner
// =================================
$bdy = "Contact Name : " . $contactname . $cr;
$bdy .= "Email Address : " . $emailaddress . $cr;
$bdy .= "Home Phone : " . $homephone . $cr;
$bdy .= "Mobile Phone : " . $mobilephone . $cr;
$bdy .= "Hotel/Resort : " . $hotelname . $cr;
$bdy .= "Room Number : " . $hotelroom . $cr;
$bdy .= "Arrival Date : " . $arrivaldate . $cr;
$bdy .= "Boat Name : " . $boatname . $cr;
$bdy .= "Booking Type : " . $privatecharter . $cr;
$bdy .= "Start Date : " . $startdate . $cr;
$bdy .= "Days Required : " . $daysrequired . $cr;
$bdy .= "Flexibility : " . "Upto " . $flexibilitybefore . " day(s) before" . $cr;
$bdy .= " " . "Upto " . $flexibilityafter . " day(s) after" . $cr;
$bdy .= "How Many Guests : " . $guestcount . $cr;
$bdy .= $cr;
$bdy .= "==================================================" . $cr . "Guest Details :-" . $cr . $guestdetails . $cr;
$bdy .= "==================================================" . $cr . "Notes/Comments etc :-" . $cr . $enquiry . $cr;
$bdy .= "==================================================" . $cr . $cr;
$provided=$bdy;
$bdy .= "IP Address : " . $ipaddress . $cr . $cr;
$to = $WebsiteSoftTitle . " <info@" . $WebsiteDomainName . ">";
$subject = "Letter " . $privatecharter . " Booking From " . $contactname;
$message = $bdy;
$headers = "From: " . $contactname . " <" . $emailaddress . ">\r\n";
$mail_sent = @mail( $to, $subject, $message, $headers );
// Send confirmation email to the person submitting the message
// ============================================================
$bdy = "Dear " . $contactname . "," . $cr . $cr;
$bdy .= "We've received your booking enquiry and will respond as soon as possible." . $cr . $cr;
$bdy .= "Regards," . $cr . $cr;
$bdy .= $TextEmailBodyEnd;
$bdy .= $cr . $cr;
$bdy .= "************************************************************" . $cr . $cr;
$bdy .= $provided;
$to = $contactname . " <" . $emailaddress . ">";
$subject = "We Received Your " . $privatecharter . " Enquiry";
$message = $bdy;
$headers = "From: " . $WebsiteSoftTitle . " <steve@" . $WebsiteDomainName . ">\r\n";
$mail_sent = @mail( $to, $subject, $message, $headers );
$sent=1;
} else {
$warning=1;
$infomsg="Please fix the problems with the highlighted fields!";
}
} else {
$boatname = $_GET['bid'];
if ($pconly=='Y') {
$privatecharter = "Private-Charter"; // default
} else {
$privatecharter = "Join-On"; // default
}
$antispamcode=GetAntiSpamCode();
}
if ($flexibilitybefore=="") $flexibilitybefore="0";
if ($flexibilityafter=="") $flexibilityafter="0";
?>
<script type="text/javascript" src="/js/date-picker-v5/js/datepicker.js">{"describedby":"fd-dp-aria-describedby"}</script>
<link href="/js/date-picker-v5/css/datepicker.css" rel="stylesheet" type="text/css" />
<script>
function pad(value, length) { // used by date-picker-v5
length = length || 2;
return "0000".substr(0,length - Math.min(String(value).length, length)) + value;
};
</script>
</head>
<body>
<? if ($sent==0) { ?>
<span class="pageheader">Make Your Booking</span><br>
<br>
<? } ?>
<? if ($sent==0) { ?>
<strong>We'd Like To Hear From You</strong><br>
Please complete the fields below so that we can check for availability and find out if you have any special requests. Up on receipt of your enquiry, we will check availability of the boat you're interested in and reply personally by phone and/or email with information for you. You're under no obligation by completing this form. You are making an enquiry, not a booking. Bookings will be confirmed to you by email and/or telephone. If you provide your mobile number, we can also use SMS (text messages) to keep in touch with you too.<br>
<br>
<br>
<? } ?>
<!-- beginning of section -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="" align="center" valign="top"><? if ($sent==1) { ?>
<table width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><img src="/images/page-tick-green-large.jpg" width="48" height="48" border="0"><br>
<img src="images/spacer.gif" width="1" height="15" border="0"><br>
<b>Your booking has been sent!</b><br>
<br>
Great to hear from you.<br>
We've received your message and will respond as soon as possible.<br>
If you would like to chat with us just let us know and we can call you at a convenient time.<br>
Please make sure you provide your country code with your number if you are outside Thailand.<br>
Looking forward to seeing you soon.</td>
</tr>
</table>
<? } else { ?>
<table width="" border="0" cellspacing="0" cellpadding="0">
<? if ($warning==1) { ?>
<tr>
<td><img src="/images/spacer.gif" width="1" height="5" border="0"></td>
</tr>
<tr>
<td><table width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"><img src="/images/warning-triangle-animated-small.gif" width="24" height="22" border="0"></td>
<td width="5"><img src="/images/spacer.gif" width="5" height="1" border="0">
<td width="" class="infomsg"><? echo $infomsg ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="/images/spacer.gif" width="1" height="20" border="0"></td>
</tr>
<? } ?>
<tr>
<td><table width="" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><table width="" border="0" cellspacing="0" cellpadding="5" align="center">
<form name="enquiryform" method="post" action="">
<tr>
<td align="right" class="inputareafieldnamebg"><table width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="" class="inputareafieldname" align="right" nowrap="nowrap">Your Name</td>
<td width="10"><img src="/images/spacer.gif" width="10" height="1" border="0"></td>
<td width="24"><img src="/images/<? echo $contactnameinfoimg ?>" width="24" height="24" border="0" onMouseover="ddrivetip('<b>Name</b><br>Please tell us your name.<? echo $inputareatooltipmandatory ?>')"; onMouseout="hideddrivetip()"></td>
</tr>
</table></td>
<td width="" class="inputareaskinbg"><input type="text" name="contactname" style="<? echo $contactnameinputclass ?>width:300px;" value="<? echo $contactname ?>" ></td>
</tr>
<tr>
<td colspan="2" class="inputareafieldnamebg" ><img src="/images/spacer.gif" width="5" height="1" border="0"></td>
<td colspan="99"><img src="/images/spacer.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<td align="right" class="inputareafieldnamebg"><table width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="" class="inputareafieldname" align="right" nowrap="nowrap">Email Address</td>
<td width="10"><img src="/images/spacer.gif" width="10" height="1" border="0"></td>
<td width="24"><img src="/images/<? echo $emailaddressinfoimg ?>" width="24" height="24" border="0" onMouseover="ddrivetip('<b>Email Address</b><br>We\'ll always reply by email unless we think that an urgent response is required.<? echo $inputareatooltipmandatory ?>')"; onMouseout="hideddrivetip()"></td>
</tr>
</table></td>
<td width="150" class="inputareaskinbg"><input type="text" name="emailaddress" style="<? echo $emailaddressinputclass ?>width:300px;" value="<? echo $emailaddress ?>"></td>
</tr>
<tr>
<td colspan="2" class="inputareafieldnamebg" ><img src="/images/spacer.gif" width="5" height="1" border="0"></td>
<td colspan="99"><img src="/images/spacer.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<td align="right" class="inputareafieldnamebg"><table width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="" class="inputareafieldnameoptional" align="right" nowrap="nowrap">Home Phone </td>
<td width="10"><img src="/images/spacer.gif" width="10" height="1" border="0"></td>
<td width="24"><img src="/images/<? echo $homephoneinfoimg ?>" width="24" height="24" border="0" onMouseover="ddrivetip('<b>Home Phone Number</b><br>If you provide this, we will be happy to call you.<br>If provided, please include your country dialing code.<? echo $inputareatooltipoptional ?>')"; onMouseout="hideddrivetip()"></td>
</tr>
</table></td>
<td width="150" class="inputareaskinbg"><input type="text" name="homephone" style="<? echo $homephoneinputclass ?>width:300px;" value="<? echo $homephone ?>"></td>
</tr>
<tr>
<td colspan="2" class="inputareafieldnamebg" ><img src="/images/spacer.gif" width="5" height="1" border="0"></td>
<td colspan="99"><img src="/images/spacer.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<td align="right" class="inputareafieldnamebg"><table width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="" class="inputareafieldnameoptional" align="right" nowrap="nowrap">Mobile Phone</td>
<td width="10"><img src="/images/spacer.gif" width="10" height="1" border="0"></td>
<td width="24"><img src="/images/<? echo $mobilephoneinfoimg ?>" width="24" height="24" border="0" onMouseover="ddrivetip('<b>Mobile Phone Number</b><br>If you provide this, we will be happy to call you.<br>If provided, please include your country dialing code.<? echo $inputareatooltipoptional ?>')"; onMouseout="hideddrivetip()"></td>
</tr>
</table></td>
<td width="150" class="inputareaskinbg"><input type="text" name="mobilephone" style="<? echo $mobilephoneinputclass ?>width:300px;" value="<? echo $mobilephone ?>"></td>
</tr>
<tr>
<td colspan="2" class="inputareafieldnamebg" ><img src="/images/spacer.gif" width="5" height="1" border="0"></td>
<td colspan="99"><img src="/images/spacer.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<td align="right" class="inputareafieldnamebg"><table width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="" class="inputareafieldnameoptional" align="right" nowrap="nowrap">Hotel/Resort Name</td>
<td width="10"><img src="/images/spacer.gif" width="10" height="1" border="0"></td>
<td width="24"><img src="/images/<? echo $hotelnameinfoimg ?>" width="24" height="24" border="0" onMouseover="ddrivetip('<b>Hotel or Resort Name</b><br>This helps us identify any transportation problems in advance.<? echo $inputareatooltipoptional ?>')"; onMouseout="hideddrivetip()"></td>
</tr>
</table></td>
<td width="150" class="inputareaskinbg"><input type="text" name="hotelname" style="<? echo $hotelnameinputclass ?>width:300px;" value="<? echo $hotelname ?>"></td>
</tr>
<tr>
<td colspan="2" class="inputareafieldnamebg" ><img src="/images/spacer.gif" width="5" height="1" border="0"></td>
<td colspan="99"><img src="/images/spacer.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<td align="right" class="inputareafieldnamebg"><table width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="" class="inputareafieldnameoptional" align="right" nowrap="nowrap">Hotel/Resort Room No</td>
<td width="10"><img src="/images/spacer.gif" width="10" height="1" border="0"></td>
<td width="24"><img src="/images/<? echo $hotelroominfoimg ?>" width="24" height="24" border="0" onMouseover="ddrivetip('<b>Room Number</b><br>Very useful for us to have. For enquiries if you are in Phuket already, and also for the day of the pickup.<? echo $inputareatooltipoptional ?>')"; onMouseout="hideddrivetip()"></td>
</tr>
</table></td>
<td width="150" class="inputareaskinbg"><input type="text" name="hotelroom" style="<? echo $hotelroominputclass ?>width:300px;" value="<? echo $hotelroom ?>"></td>
</tr>
<tr>
<td colspan="2" class="inputareafieldnamebg" ><img src="/images/spacer.gif" width="5" height="1" border="0"></td>
<td colspan="99"><img src="/images/spacer.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<td align="right" class="inputareafieldnamebg"><table width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="" class="inputareafieldnameoptional" align="right" nowrap="nowrap">Date of Arrival in Phuket</td>
<td width="10"><img src="/images/spacer.gif" width="10" height="1" border="0"></td>
<td width="24"><img src="/images/<? echo $arrivaldateinfoimg ?>" width="24" height="24" border="0" onMouseover="ddrivetip('<b>Phuket Arrival Date</b><br>Helps us guide you with better information.<br><br>Hey, did you know we do airport transfers in our own minibuses too?<? echo $inputareatooltipoptional ?>')"; onMouseout="hideddrivetip()"></td>
</tr>
</table></td>
<td width="150" nowrap="nowrap" class="inputareaskinbg"><table width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="text" name="arrivaldate" id="arrivaldate" style="<? echo $arrivaldateinputclass ?>width:250px;" value="<? echo $arrivaldate ?>"></td>
<td> </td>
<td><script type="text/javascript">
// <![CDATA[
var today = new Date(),
rangeLow = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate()),
rangeHigh = new Date(today.getFullYear() + 1, today.getMonth(), today.getDate())
var opts = {
// Attach input with an id of "dp-1" and give it a "d-sl-m-sl-Y" date format (e.g. 13/03/1990)
formElements:{"arrivaldate":"l-cc-sp-d-sp-F-sp-Y"},
rangeLow:rangeLow.getFullYear() + "" + pad(rangeLow.getMonth()+1) + pad(rangeLow.getDate()),
rangeHigh:rangeHigh.getFullYear() + "" + pad(rangeHigh.getMonth()+1) + pad(rangeHigh.getDate())
};
datePickerController.createDatePicker(opts);
// ]]>
</script></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" class="inputareafieldnamebg" ><img src="/images/spacer.gif" width="5" height="1" border="0"></td>
<td colspan="99"><img src="/images/spacer.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<td align="right" class="inputareafieldnamebg"><table width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="" class="inputareafieldname" align="right" nowrap="nowrap">Interested In Which Boat</td>
<td width="10"><img src="/images/spacer.gif" width="10" height="1" border="0"></td>
<td width="24"><img src="/images/<? echo $boatnameinfoimg ?>" width="24" height="24" border="0" onMouseover="ddrivetip('<b>Which Boat</b><br>If you are not sure about which boat, say so here, and we will find out which ones are available on the start date you specify.<? echo $inputareatooltipmandatory ?>')"; onMouseout="hideddrivetip()"></td>
</tr>
</table></td>
<td width="150" class="inputareaskinbg"><input type="text" name="boatname" style="<? echo $boatnameinputclass ?>width:300px;" value="<? echo $boatname ?>"></td>
</tr>
<tr>
<td colspan="2" class="inputareafieldnamebg" ><img src="/images/spacer.gif" width="5" height="1" border="0"></td>
<td colspan="99"><img src="/images/spacer.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<td align="right" class="inputareafieldnamebg"><table width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="" class="inputareafieldname" align="right" nowrap="nowrap">Join-On / Private-Charter</td>
<td width="10"><img src="/images/spacer.gif" width="10" height="1" border="0"></td>
<td width="24"><img src="/images/<? echo $privatecharterinfoimg ?>" width="24" height="24" border="0" onMouseover="ddrivetip('<b>Private Charter</b><br>Select private-charter if you want the boat to yourself!<? echo $inputareatooltipmandatory ?>')"; onMouseout="hideddrivetip()"></td>
</tr>
</table></td>
<td width="150" nowrap="nowrap" class="inputareaskinbg"><table width="" border="0" cellspacing="0" cellpadding="0">
<? if ($pconly!='Y') { ?>
<tr>
<td><input type="radio" name="privatecharter" <? if ($privatecharter=="Join-On") { ?>checked<? } ?> value="Join-On"></td>
<td> Join-On</td>
</tr>
<? } ?>
<tr>
<td><input type="radio" name="privatecharter" <? if ($privatecharter=="Private-Charter") { ?>checked<? } ?> value="Private-Charter"></td>
<td> Private-Charter</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" class="inputareafieldnamebg" ><img src="/images/spacer.gif" width="5" height="1" border="0"></td>
<td colspan="99"><img src="/images/spacer.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<td align="right" class="inputareafieldnamebg"><table width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="" class="inputareafieldname" align="right" nowrap="nowrap"><label for="startdate">Starting On Which Date</label></td>
<td width="10"><img src="/images/spacer.gif" width="10" height="1" border="0"></td>
<td width="24"><img src="/images/<? echo $startdateinfoimg ?>" width="24" height="24" border="0" onMouseover="ddrivetip('<b>Start Date</b><br>We need this to check availability. And we use it in conjunction with the Flexibility option.<? echo $inputareatooltipmandatory ?>')"; onMouseout="hideddrivetip()"></td>
</tr>
</table></td>
<td width="150" nowrap="nowra