Recaptcha with Salesforce Web-To-Lead - php
I have a salesforce web-to-lead form that I have on my website. Everything works fine but there is no recaptcha or any way to prevent spamming. So I downloaded recaptcha, got everything setup, and I also followed the instructions here to take the $_POST data, verify the recaptcha is correct and then submit it over to salesforce.
I got all of that setup but when I submit the form it just goes to my check-this-first.php (I called it contactFormConfirm.php) page and is just blank. It doesn't hit the retURL or actually submit to salesforce.
Any light that can be shed to help me out would be amazing. Thank you in advance.
Here is the code that I am using:
Salesforce Web to Lead:
<form action="/contactFormConfirm.php" method="POST">
<input type=hidden name="oid" value="#############">
<input type=hidden name="retURL" value="http://www.google.com">
<div class="row span12 pull-left">
<div class="span6 pull-left">
<label for="first_name" class="span3">First Name</label>
<input id="first_name" maxlength="40" name="first_name" size="20" type="text" class="span9" />
</div>
<div class="span6 pull-left">
<label for="last_name" class="span3">Last Name</label>
<input id="last_name" maxlength="80" name="last_name" size="20" type="text" class="span9" /><br>
</div>
</div>
<div class="clearfix"></div>
<div class="row span12 pull-left">
<div class="span6 pull-left">
<label for="title" class="span3">Title</label>
<input id="title" maxlength="40" name="title" size="20" type="text" class="span9" /><br>
</div>
<div class="span6 pull-left">
<label for="email" class="span3">Email</label>
<input id="email" maxlength="80" name="email" size="20" type="text" class="span9" /><br>
</div>
</div>
<div class="clearfix"></div>
<div class="row span12 pull-left">
<div class="span6 pull-left">
<label for="phone" class="span3">Phone</label>
<input id="phone" maxlength="40" name="phone" size="20" type="text" class="span9" /><br>
</div>
<div class="span6 pull-left">
<label for="00N4000000231ne" class="span3" style="position:relative; top:-1.2em;">Profile:</label>
<select id="profile" name="00N4000000231ne" title="Profile" class="span9"> <option value="">--None--</option>
**[other options hidden for privacy]**
</select>
</div>
</div>
<div class="clearfix"></div>
<div class="row span12 pull-left">
<div class="span6 pull-left">
<label for="company" class="span3">Company</label>
<input id="company" maxlength="40" name="company" size="20" type="text" class="span9" /><br>
</div>
<div class="span6 pull-left">
<label for="country" class="span3">Country</label>
<input id="country" maxlength="40" name="country" size="20" type="text" class="span9" /><br>
</div>
</div>
<div class="row span12 pull-left">
<div class="span6 pull-left">
<label for="street" class="span3">Address</label>
<textarea name="street" class="span9"></textarea><br>
</div>
<div class="span6 pull-left">
<label for="city" class="span3">City</label>
<input id="city" maxlength="40" name="city" size="20" type="text" class="span9" /><br>
</div>
</div>
<div class="clearfix"></div>
<div class="row span12 pull-left">
<div class="span6 pull-left">
<label for="state" class="span3" style="position:relative; top:-1.2em;">State / Province</label>
<input id="state" maxlength="20" name="state" size="20" type="text" class="span9" /><br>
</div>
<div class="span6 pull-left">
<label for="zip" class="span3">Zip</label>
<input id="zip" maxlength="20" name="zip" size="20" type="text" class="span9" /><br>
</div>
</div>
<div class="clearfix"></div>
<div class="row span12 pull-left">
<div class="span6 pull-left">
<label for="00N40000001V9wA" class="span3" style="position:relative; top:-1.2em;">Product Interest:</label>
<select id="productInterest" multiple="multiple" name="00N40000001V9wA" title="Product Interest" class="span9" size="5">
<option value="API">API</option>
**[other options hidden for privacy]**
</select><br>
</div>
<div class="span6 pull-left">
<label for="00N40000001V8Yl" class="span3" style="position:relative; top:-1.2em;">Background Notes:</label>
<textarea id="notes" name="00N40000001V8Yl" type="text" wrap="soft" class="span9"></textarea><br>
</div>
</div>
<div class="clearfix"><br /></div>
<div class="span12 offset3">
<div class="span10 pull-right">
<label for="lead_source" class="span8 pull-left">Check here to be contacted by *** for a demonstration.</label>
<input id="demonstration" type="checkbox" name="lead_source" class="span1 pull-left" value="Web w/Demo Request"></input>
</div>
<div class="span10 pull-right">
<label for="00N400000023QE0" class="span8 pull-left">Check here if you have a timeline for this project.</label>
<input id="timeline" type="checkbox" name="00N400000023QE0" class="span1 pull-left" value="Confirmed"></input>
</div>
<div class="span10 pull-right">
<label for="00N400000023QE5" class="span8 pull-left">Check here if you have purchase authority for this project.</label>
<input id="purchaseAuthority" type="checkbox" name="00N400000023QE5" class="span1 pull-left" value="Confirmed"></input>
</div>
</div>
<div class="clearfix"><br /></div>
<div class="row-fluid">
<div class="span9 pull-right offset2">
<div class="span8">
<?php
require_once('recaptcha/recaptchalib.php');
$publickey = "xxxxxxxxxxxxx"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?><br />
</div>
</div>
</div>
<input type="hidden" name="lead_source" value="Web" />
<input type="hidden" name="00N4000000231kf" value="Web Inquiry" />
<div class="span10 offset1 pull-right">
<input type="submit" name="ctl00$ctl00$MainContent$mainContentHolder$btnSubmit" value="Submit Inquiry" class="btn btn-primary span3 pull-right" />
</div>
</form>
This is the contactFormConfirm.php code with the php cURL code:
<?php
ob_start();
session_start();
include_once('[path-to]/recaptcha/recaptchalib.php');
//Recaptcha Settings
$publickey = "xxxxxxxxx"; // you got this from the signup page
$privatekey = "xxxxxxxxx";
//curl method posting
//extract data from the post
extract($_POST);
if (isset($submit)){
$ok = 1;
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
$ok = 0;
}
if ($ok){
//set POST variables
$url = 'https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8';
$fields = array(
'oid'=>urlencode($oid),
'retURL'=>urlencode($retURL),
'first_name'=>urlencode($first_name),
'last_name'=>urlencode($last_name),
'title'=>urlencode($title),
'email'=>urlencode($email),
'phone'=>urlencode($phone),
'00N4000000231ne'=>urlencode($profile),
'company'=>urlencode($company),
'country'=>urlencode($country),
'address'=>urlencode($address),
'city'=>urlencode($city),
'state'=>urlencode($state),
'zip'=>urlencode($zip),
'00N40000001V9wA'=>urlencode($productInterest),
'00N40000001V8Yl'=>urlencode($notes),
'lead_source'=>urlencode($demonstration),
'00N400000023QE0'=>urlencode($timeline),
'00N400000023QE5'=>urlencode($purchaseAuthority)
);
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
//print_r($fields_string);
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
} //if ok
else {
echo "<h4>Sorry - Invalid Captcha </h4>";
}
} //if submit.
?>
After working for several hours, me and another developer at work were able to solve this issue using the solution (kind of) above.
Here's how it broke down:
<script type="text/javascript">
var RecaptchaOptions = {
theme : 'clean'
};
</script>
<form action="/contactFormConfirm.php" method="POST" >
<input type=hidden name="oid" value="#########">
<input type=hidden name="retURL" value="http://www.website.com/thank-you/">
<div class="row span12 pull-left">
<div class="span6 pull-left">
<label for="first_name" class="span3">First Name</label>
<input id="first_name" maxlength="40" name="first_name" size="20" type="text" class="span9" />
</div>
<div class="span6 pull-left">
<label for="last_name" class="span3">Last Name</label>
<input id="last_name" maxlength="80" name="last_name" size="20" type="text" class="span9" /><br>
</div>
</div>
<div class="clearfix"></div>
<div class="row span12 pull-left">
<div class="span6 pull-left">
<label for="title" class="span3">Title</label>
<input id="title" maxlength="40" name="title" size="20" type="text" class="span9" /><br>
</div>
<div class="span6 pull-left">
<label for="email" class="span3">Email</label>
<input id="email" maxlength="80" name="email" size="20" type="text" class="span9" /><br>
</div>
</div>
<div class="clearfix"></div>
<div class="row span12 pull-left">
<div class="span6 pull-left">
<label for="phone" class="span3">Phone</label>
<input id="phone" maxlength="40" name="phone" size="20" type="text" class="span9" /><br>
</div>
<div class="span6 pull-left">
<label for="profile" class="span3" style="position:relative; top:-1.2em;">Profile:</label>
<select id="profile" name="profile" title="OverDrive Profile" class="span9">
<option value="">--None--</option>
</select>
</div>
</div>
<div class="clearfix"></div>
<div class="row span12 pull-left">
<div class="span6 pull-left">
<label for="company" class="span3">Company</label>
<input id="company" maxlength="40" name="company" size="20" type="text" class="span9" /><br>
</div>
<div class="span6 pull-left">
<label for="country" class="span3">Country</label>
<input id="country" maxlength="40" name="country" size="20" type="text" class="span9" /><br>
</div>
</div>
<div class="row span12 pull-left">
<div class="span6 pull-left">
<label for="street" class="span3">Address</label>
<textarea name="street" class="span9"></textarea><br>
</div>
<div class="span6 pull-left">
<label for="city" class="span3">City</label>
<input id="city" maxlength="40" name="city" size="20" type="text" class="span9" /><br>
</div>
</div>
<div class="clearfix"></div>
<div class="row span12 pull-left">
<div class="span6 pull-left">
<label for="state" class="span3" style="position:relative; top:-1.2em;">State / Province</label>
<input id="state" maxlength="20" name="state" size="20" type="text" class="span9" /><br>
</div>
<div class="span6 pull-left">
<label for="zip" class="span3">Zip</label>
<input id="zip" maxlength="20" name="zip" size="20" type="text" class="span9" /><br>
</div>
</div>
<div class="clearfix"></div>
<div class="row span12 pull-left">
<div class="span6 pull-left">
<label for="productInterest" class="span3" style="position:relative; top:-1.2em;">Product Interest:</label>
<select id="productInterest" multiple="multiple" name="productInterest" title="Product Interest" class="span9" size="5">
<option value="API">API</option>
</select><br>
</div>
<div class="span6 pull-left">
<label for="notes" class="span3" style="position:relative; top:-1.2em;">Background Notes:</label>
<textarea id="notes" name="notes" type="text" wrap="soft" class="span9"></textarea><br>
</div>
</div>
<div class="clearfix"><br /></div>
<div class="span12 offset3">
<div class="span10 pull-right">
<label for="lead_source" class="span8 pull-left">Check here to be contacted for a demonstration.</label>
<input id="lead_source" type="checkbox" name="lead_source" class="span1 pull-left" value="Web w/Demo Request"></input>
</div>
<div class="span10 pull-right">
<label for="timeline" class="span8 pull-left">Check here if you have a timeline for this project.</label>
<input id="timeline" type="checkbox" name="timeline" class="span1 pull-left" value="Confirmed"></input>
</div>
<div class="span10 pull-right">
<label for="purchaseAuthority" class="span8 pull-left">Check here if you have purchase authority for this project.</label>
<input id="purchaseAuthority" type="checkbox" name="purchaseAuthority" class="span1 pull-left" value="Confirmed"></input>
</div>
</div>
<div class="clearfix"><br /></div>
<div class="row-fluid">
<div class="span9 pull-right offset2">
<div class="span8">
<?php
require_once('recaptcha/recaptchalib.php');
$publickey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?><br />
</div>
</div>
</div>
<div class="span10 offset1 pull-right">
<input type="submit" name="submit" value="Submit Inquiry" class="btn btn-primary span3 pull-right" />
</div>
</form>
And here's the contactFormConfirm file:
<?php
ob_start();
session_start();
include_once('path-to/recaptcha/recaptchalib.php');
//Recaptcha Settings
$publickey = "xxxxxxxxxxxxxxxxxxxxxxxxx"; // you got this from the signup page
$privatekey = "xxxxxxxxxxxxxxxxxxxxxxxx";
//curl method posting
//extract data from the post
extract($_POST);
if ($submit == 'Submit Inquiry'){
$ok = 1;
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
$ok = 0;
}
if ($ok){
//set POST variables
$url = 'salesforce URL';
$fields = array(
'oid'=>urlencode($oid),
'retURL'=>urlencode($retURL),
'first_name'=>urlencode($first_name),
'last_name'=>urlencode($last_name),
'title'=>urlencode($title),
'email'=>urlencode($email),
'phone'=>urlencode($phone),
'XXXXXXXXXXXXXXXX'=>urlencode($profile),
'company'=>urlencode($company),
'country'=>urlencode($country),
'address'=>urlencode($street),
'city'=>urlencode($city),
'state'=>urlencode($state),
'zip'=>urlencode($zip),
'XXXXXXXXXXXXXXXX'=>urlencode($productInterest),
'XXXXXXXXXXXXXXXX'=>urlencode($notes)
);
// replace XXXXXX with custom field ID
// send default "lead source" value if it is not passed in the HTML form
if (isset($lead_source))
{
$fields['XXXXXXXXXXXXXXXXX'] = urlencode('Web w/Demo Request');
}
else
{
$fields['XXXXXXXXXXXXXXXXX'] = urlencode('Web');
}
// add values to array if they are passed in via the HTML form
if (isset($timeline))
{
$fields['XXXXXXXXXXXXXXXXX'] = urlencode($timeline);
}
if (isset($purchaseAuthority))
{
$fields['XXXXXXXXXXXXXXXX'] = urlencode($purchaseAuthority);
}
// add constant fields
$fields['XXXXXXXXXXXXXXX'] = urlencode('Web Inquiry');
$fields['recordType'] = urlencode('XXXXXXXXXXXXXXX');
//url-ify the data for the POST
$fields_string = '';
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
$fields_string = substr($fields_string, 0, -1); // delete last &
rtrim($fields_string,'&');
//print_r($fields_string);
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
} //if ok
else {
echo "<h4>Sorry - Invalid Captcha </h4>";
}
} //if submit.
?>
I know this is an old thread but I came across it while attempting to do the same thing and came up with this solution:
<?php
ob_start();
session_start();
require_once('recaptchalib.php');
$key_public = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$key_private = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$captchaFailed = false;
$response = null;
$reCaptcha = new ReCaptcha($key_private);
if (!function_exists('curl_version')) {
die('Curl package missing.');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST['g-recaptcha-response'])) {
$response = $reCaptcha->verifyResponse(
$_SERVER['REMOTE_ADDR'],
$_POST['g-recaptcha-response']
);
if ($response !== null) {
if ($response->success) {
$fields = $_POST;
$sendURL = $fields['sendURL'];
unset($fields['sendURL']);
unset($fields['g-recaptcha-response']);
$fields_string = http_build_query($fields);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $sendURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
$result = curl_exec($ch);
curl_close($ch);
} else {
$captchaFailed = true;
}
} else {
$captchaFailed = true;
}
} else {
$captchaFailed = true;
}
}
if ($captchaFailed && count(get_included_files()) < 3) {
echo 'reCAPTCHA failed! Please go back and try again.';
}
?>
You will need to create a hidden input field called sendURL with the value of the URL you'd like to send the form to.
You can either set the action of your form to a file with the code above or include it at the top of the page with your form and leave the action blank.
An example of including it all in the same page could be something like this:
<?php require_once('form-submit.php'); ?>
<html>
<body>
<form method="post">
<input type="hidden" name="sendURL" value="https://login.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8&...">
<label for="name">Name:</label>
<input type="text" name="name" value="<?php if (!empty($_POST['name'])) { echo $_POST['name']; } ?>">
<label for="email">E-Mail:</label>
<input type="text" name="email" value="<?php if (!empty($_POST['email'])) { echo $_POST['email']; } ?>">
<label for="message">Message:</label>
<textarea name="message"><?php if (!empty($_POST['message'])) { echo $_POST['message']; } ?></textarea>
<?php if ($captchaFailed): ?>
<p>reCAPTCHA failed! Please try again!</p>
<?php endif; ?>
<div class="g-recaptcha" data-sitekey="<?php echo $key_public; ?>"></div>
</form>
<script src="https://www.google.com/recaptcha/api.js"></script>
</body>
</html>
And you could use this for pretty much any case where you need to validate the reCAPTCHA before sending the form data off somewhere else.
Related
Adding an additional field breaks my query
When I add an additional field to my query, it fails. I have checked the spelling 20 or more times....I do not know what is wrong.. Please help!! Working code BELOW if(isset($_POST['UPDATE_RAW'])) { extract($_POST); $sql=mysqli_query($db,"update nma_raw set NMA_System='$nmasystem',NMA_Ticket_Number='$nmaticketnum',Tkt_Priority='$tktpriority',Created_On_Worklist='$createdonworklist',Create_Date='$createdate',Create_Time='$createtime',Days_Old='$daysold',Interval_Onlist='$intervalonlist',Check_Status='$checkstatus',Ticket_Status='$ticketstatus',Relate_Status='$relatestatus',WFA_TR_Num='$wfatrnum',Recent_WFA_Dispatch_Status='$recentwfadispatchstatus',Last_Owner='$lastowner',Entity_Status='$entitystatus',Entity='$entity',First_Cond_Type='$firstcondtype',Last_Cond_Type='$lastcondtype',State='$st',CLLI='$clli',Check_Active='$checkactive',Check_Jepd='$checkjepd' WHERE ID='$id'"); if($sql) { echo "<script>alert('Updated SuccessFully');window.location.href='Active_Tkt_Qry_List_Frm_NMA.php';</script>"; } else { echo "<script>alert('Some ERRORS');</script>"; } } NOT WORKING CODE BELOW! if(isset($_POST['UPDATE_RAW'])) { extract($_POST); $sql = mysqli_query($db,"update nma_raw set NMA_System='$nmasystem',NMA_Ticket_Number='$nmaticketnum',Tkt_Priority='$tktpriority',Created_On_Worklist='$createdonworklist',Create_Date='$createdate',Create_Time='$createtime',Days_Old='$daysold',Interval_Onlist='$intervalonlist',Check_Status='$checkstatus',Ticket_Status='$ticketstatus',Relate_Status='$relatestatus',WFA_TR_Num='$wfatrnum',Recent_WFA_Dispatch_Status='$recentwfadispatchstatus',Last_Owner='$lastowner',Entity_Status='$entitystatus',Entity='$entity',First_Cond_Type='$firstcondtype',Last_Cond_Type='$lastcondtype',State='$st',CLLI='$clli',Check_Active='$checkactive',Check_Jepd='$checkjepd', Resolved_Date='$resolved_date' WHERE ID='$id'"); if($sql) { echo "<script>alert('Updated SuccessFully');window.location.href='Active_Tkt_Qry_List_Frm_NMA.php';</script>"; } else { echo "<script>alert('Some ERRORS');</script>"; } } HERE IS A PICTURE OF MY DB SCHEMA enter image description here HERE IS THE TOTAL PHP FILE <?php include_once "header.php";?> <section class="content"> <div class="page-body clearfix"> <?php $id=$_REQUEST['id']; $sql=mysqli_query($db,"SELECT NMA_RAW.*, NMA_RAW.Check_Status, NMA_RAW.Resolved_Date, NMA_RAW.Filtered_Date FROM NMA_RAW WHERE (((NMA_RAW.Check_Status)='OK') AND ((NMA_RAW.Resolved_Date) Is Null) AND ((NMA_RAW.Filtered_Date) Is Null)) AND NMA_RAW.ID = $id;"); $row = mysqli_fetch_array($sql); ?> <div class="panel panel-default"> <div class="panel-heading">NMA Active Ticket Form</div> <div class="panel-body"> <form class="form-horizontal" action="" method="post"> <div class="form-group"> <div class="col-sm-4"> <label>NMA System</label> <input type="text" id="nma_system" class="form-control" placeholder="NMA System" value="<?= $row['NMA_System']; ?>" name="nmasystem"> </div> <div class="col-sm-4"> <label>NMA Ticket Number</label> <input type="text" id="nma_ticket_number" class="form-control" placeholder="NMA Ticket Number" value="<?= $row['NMA_Ticket_Number']; ?>" name="nmaticketnum"> </div> <div class="col-sm-4"> <label>Ticket Priority</label> <input type="text" id="ticket_priority" class="form-control" placeholder="Ticket Priority" value="<?= $row['Tkt_Priority']; ?>" name="tktpriority"> </div> </div> <div class="form-group"> <div class="col-sm-4"> <label>Created On Worklist</label> <input type="text" id="created_on_work_list" class="form-control" placeholder="Created On Worklist" value="<?= $row['Created_On_Worklist']; ?>" name="createdonworklist"> </div> <div class="col-sm-4"> <label>Created Date</label> <div class="input-group"> <span class="input-group-addon"> <i class="fa fa-calendar"></i> </span> <input type="date" id="created_date" class="form-control" placeholder="Created Date" value="<?= $row['Create_Date']; ?>" name="createdate"> </div> </div> <div class="col-sm-4"> <label>Created time</label> <div class="input-group"> <span class="input-group-addon"> <i class="fa fa-calendar"></i> </span> <input type="time" id="created_time" class="form-control" placeholder="Created Time" value="<?= $row['Create_Time']; ?>" name="createtime"> </div> </div> </div> <div class="form-group"> <div class="col-sm-4"> <label>Days Old</label> <input type="text" id="days_old" class="form-control" placeholder="Days old" value="<?= $row['Days_Old']; ?>" name="daysold"> </div> <div class="col-sm-4"> <label>Check</label> <input type="text" id="check" class="form-control" placeholder="Check" value="<?= $row['Check_Status']; ?>" name="checkstatus"> </div> <div class="col-sm-4"> <label>Ticket Status</label> <input type="text" id="ticket_status" class="form-control" placeholder="Ticket Status" value="<?= $row['Ticket_Status']; ?>" name="ticketstatus"> </div> </div> <div class="form-group"> <div class="col-sm-4"> <label>Interval</label> <input type="text" id="interval" class="form-control" placeholder="Interval" value="<?= $row['Interval_Onlist']; ?>" name="intervalonlist"> </div> <div class="col-sm-4"> <label>Related Status</label> <input type="text" id="relate_status" class="form-control" placeholder="Relate Status" value="<?= $row['Relate_Status']; ?>" name="relatestatus"> </div> <div class="col-sm-4"> <label>WFA TR Num</label> <input type="text" id="wfa_tr_num" class="form-control" placeholder="WF TR Num" value="<?= $row['WFA_TR_Num']; ?>" name="wfatrnum"> </div> </div> <div class="form-group"> <div class="col-sm-4"> <label>Recent WFA Dispatch Status</label> <input type="text" id="recent_wfa_dispatch_status" class="form-control" placeholder="Recent WFA Dispatch Status" value="<?= $row['Recent_WFA_Dispatch_Status']; ?>" name="recentwfadispatchstatus"> </div> <div class="col-sm-4"> <label>Entity Status</label> <input type="text" id="entity_status" class="form-control" placeholder="Intity Status" value="<?= $row['Entity_Status']; ?>" name="entitystatus"> </div> <div class="col-sm-4"> <label>Entity</label> <input type="text" name="entity" id="entity" class="form-control" placeholder="Entity" value="<?= $row['Entity']; ?>" name="entity"> </div> </div> <div class="form-group"> <div class="col-sm-4"> <label>Last Owner</label> <input type="text" id="last_owner" class="form-control" placeholder="Last Owner" value="<?= $row['Last_Owner']; ?>" name="lastowner"> </div> <div class="col-sm-4"> <label>First Cond Type</label> <input type="text" id="first_cond_type" class="form-control" placeholder="First Cond Type" value="<?= $row['First_Cond_Type']; ?>" name="firstcondtype"> </div> <div class="col-sm-4"> <label>Last Cond Type</label> <input type="text" id="last_cond_type" class="form-control" placeholder="Last Cond Type" value="<?= $row['Last_Cond_Type']; ?>" name="lastcondtype"> </div> </div> <div class="form-group"> <div class="col-sm-4"> <label>State</label> <input type="text" id="state" class="form-control" placeholder="State" value="<?= $row['State']; ?>" name="st"> </div> <div class="col-sm-4"> <label>Check Active</label> <input type="text" id="check_active" class="form-control" placeholder="Check Active" value="<?= $row['Check_Active']; ?>" name="checkactive"> </div> <div class="col-sm-4"> <label>Check Jepd</label> <input type="text" name="check_jepd" id="check_jepd" class="form-control"placeholder="Check Jepd" value="<?= $row['Check_Jepd']; ?>" name="checkjepd"> </div> </div> <div class="form-group"> <div class="col-sm-4"> <label>CLLI</label> <input type="text" id="clli" class="form-control" placeholder="CLLI" value="<?= $row['CLLI']; ?>" name="clli"> </div> <div class="col-sm-4"> <label>Resolved Date</label> <div class="input-group"> <span class="input-group-addon"> <i class="fa fa-calendar"></i> </span> <input type="date" id="resolved_date" class="form-control" placeholder="Resolved_Date" value="<?= $row['Resolved_Date']; ?>" name="resolved_date"> </div> </div> <div class="col-sm-4"> <label>Filtered Date</label> <div class="input-group"> <span class="input-group-addon"> <i class="fa fa-calendar"></i> </span> <input type="date" id="filtered_date" class="form-control" placeholder="Filtered Date" value="<?= $row['Filtered_Date']; ?>" name="filtereddate"> </div> </div> </div> <div class="form-group"> <div class="col-sm-4"> <label>Filtered By</label> <input type="text" id="filtered_by" class="form-control" placeholder="Filtered by" value="<?= $row['Filtered_By']; ?>" name="filteredby"> </div> <div class="col-sm-4"> <label>Restored Date</label> <div class="input-group"> <span class="input-group-addon"> <i class="fa fa-calendar"></i> </span> <input type="date" id="restored_date" class="form-control" placeholder="Restored_Date" value="<?= $row['Restored_Date']; ?>" name="restoreddate"> </div> </div> </div> <div class="form-group"> <div class="col-sm-4 "> <label class="text-bold"> NMA Comments subform </label> </div> <div class="col-sm-4"> </div> </div> <hr> <div class="form-group"> <?php $io = mysqli_query($db,"select * from NMA_Comments where NMA_Tkt_Num='$row[NMA_Ticket_Number]'"); $tr=mysqli_fetch_assoc($io); ?> <div class="col-sm-4"> <label>NMA Ticket Number</label> <input type="text" name="NMA_Ticket_Number" id="nma_ticket_number" class="form-control" placeholder="NMA Ticket Number" value="<?php echo $tr['NMA_Tkt_Num']; ?>" > </div> <div class="col-sm-4"> <label>NMA Notes</label> <textarea type="text" name="NMA_Notes" id="nma_notes" class="form-control" placeholder="NMA Notes"><?php echo $tr['NMA_Notes']; ?></textarea> </div> <div class="col-sm-4"> <label>NMA Note Date</label> <input type="text" name="NMA_Ticket_Date" id="nma_ticket_number" class="form-control" placeholder="NMA Ticket Number" value="<?php echo $tr['NMA_Note_Date']; ?>"> </div> </div> <div class="form-group"> <div class="col-sm-4"> <button class="btn btn-primary" name="UPDATE_RAW"> Save and Close</button> </div> <div class="col-sm-4"> <button class="btn btn-success" name="MOVE_TO_RESOLVED"> Resolved and Close</button> </div> <div class="col-sm-4"> <button class="btn btn-danger" name="MOVE_TO_INHIBITS"> Inhibit and Close</button> </div> </div> </form> </div> </div> </div> </section> <?php if(isset($_POST['UPDATE_RAW'])){ extract($_POST); //print_r($_POST); $sql=mysqli_query($db,"update nma_raw set NMA_System='$nmasystem',NMA_Ticket_Number='$nmaticketnum',Tkt_Priority='$tktpriority',Created_On_Worklist='$createdonworklist',Create_Date='$createdate',Create_Time='$createtime',Days_Old='$daysold',Interval_Onlist='$intervalonlist',Check_Status='$checkstatus',Ticket_Status='$ticketstatus',Relate_Status='$relatestatus',WFA_TR_Num='$wfatrnum',Recent_WFA_Dispatch_Status='$recentwfadispatchstatus',Last_Owner='$lastowner',Entity_Status='$entitystatus',Entity='$entity',First_Cond_Type='$firstcondtype',Last_Cond_Type='$lastcondtype',State='$st',CLLI='$clli',Check_Active='$checkactive',Check_Jepd='$checkjepd', Resolved_Date='$resolved_date' WHERE ID='$id'"); if($sql){ echo"<script>alert('Updated SuccessFully');window.location.href='Active_Tkt_Qry_List_Frm_NMA.php';</script>"; } else{ echo"<script>alert('Some ERRORS');</script>"; } } ?> <?php if(isset($_POST['MOVE_TO_INHIBITS'])){ extract($_POST); //$print_r($_POSt); $sql=mysqli_query($db,"INSERT INTO nma_main_table SELECT * FROM nma_raw where ID='$id'"); if($sql){ echo"<script>alert('Updated SuccessFully');window.location.href='Active_Tkt_Qry_List_Frm_NMA.php';</script>"; } else{ echo"<script>alert('Some ERRORS');</script>"; } // sql to delete a record $sql=mysqli_query($db,"DELETE FROM nma_raw WHERE ID='$id'"); if ($sql){ echo "Record Inhibited successfully"; } else { echo "<script>alert('Error in deletion');</script>"; } } ?> <?php if(isset($_POST['MOVE_TO_RESOLVED'])){ extract($_POST); //$print_r($_POSt); $sql=mysqli_query($db,"INSERT INTO nma_main_table SELECT * FROM nma_raw where ID='$id'"); if($sql){ echo"<script>alert('Updated SuccessFully');window.location.href='Active_Tkt_Qry_List_Frm_NMA.php';</script>"; } else{ echo"<script>alert('Some ERRORS');</script>"; } // sql to delete a record $sql=mysqli_query($db,"DELETE FROM nma_raw WHERE ID='$id'"); if ($sql){ echo "Record Resolved successfully"; } else { echo "<script>alert('Error in deletion');</script>"; } } ?> <?php include_once "footer.php";?>
If the error you're getting is Incorrect date value: '' for column 15daytkt.nma_raw.Resolved_Date (as you've mentioned in the comments) : It looks like you are passing an empty string to the Resolved_Date column, and it's invalid. Please make sure you're actually passing a valid date string in this format 2019-11-15. Usually, the HTML form inputs with the date type return this format. You can verify this case by setting the value to NULL if it's empty. Try changing the query as below: $sql = mysqli_query($db,"update nma_raw set NMA_System='$nmasystem', Resolved_Date=NULLIF($resolved_date, '') WHERE ID='$id'"); Note the NULLIF($resolved_date, '') part. It will basically set the value to null if it is empty. Hope it helps.
Not displaying the error messages in PHP
If there are any errors while registration or login into the sit then it is not displaying the error message just printing the variable.Here is the code.Tried by doing echo as well but it is also not working.Tried with storing the result in a variable and displaying the message but still not worked. <?php include 'includes/db.php'; $match = ''; if(isset($_POST['submit_user'])) { $email = $_POST['email']; $check=mysqli_query($conn,"select * from users where user_email='$email'"); $checkrows=mysqli_num_rows($check); if($checkrows>0) { $msg = "Email Already Exists"; header('Location:registration.php?msg=$msg'); } else { if($_POST['password'] == $_POST['con_password']) { $ins_sql = "INSERT INTO users (first_name, last_name, user_email, user_password, username) VALUES ('$_POST[first_name]', '$_POST[last_name]', '$_POST[email]', '$_POST[password]', '$_POST[username]')"; $run_sql = mysqli_query($conn,$ins_sql); } else { $match = '<div class="alert alert-danger">Password doesn't match!</div>'; } } } ?> <form class="form-horizontal" action="registration.php" method="post" role="form"> <div class="body"> <div class="row clearfix"> <div class="col-sm-6 col-xs-12"> <div class="form-group"> <div class="form-line"> <input type="text" class="form-control" placeholder="First Name" name="first_name" id="first_name" onkeypress="return checkSpcialChar(event)" required> </div> </div> </div> <div class="col-sm-6 col-xs-12"> <div class="form-group"> <div class="form-line"> <input type="text" class="form-control" placeholder="Last Name" name="last_name" id="last_name" required> </div> </div> </div> </div> <div class="row clearfix"> <div class="col-sm-12"> <div class="form-group"> <div class="form-line"> <input type="text" class="form-control" placeholder="Enter Your Email" name="email" id="email" required> </div> </div> </div> <div class="col-sm-12"> <div class="form-group"> <div class="form-line"> <input type="password" class="form-control" placeholder="Password" name="password" id="password" required> </div> </div> </div> <div class="col-sm-12"> <div class="form-group"> <div class="form-line"> <input type="type" class="form-control" placeholder="Confirm Password" name="con_password" id="con_password" required> </div> </div> </div> <div class="col-sm-12"> <div class="form-group"> <div class="form-line"> <input type="text" class="form-control" placeholder="Enter Username" name="username" id="username"> </div> </div> </div> <div class="col-sm-12"> <div class="form-group drop-custum"> <select class="form-control show-tick" name="user_role" id="user_role" required> <option value="">-- Select User role --</option> <option value="admin">Admin</option> <option value="employee">Employee</option> </select> </div> </div> <div class="col-sm-12"> <button type="submit" class="btn btn-raised g-bg-cyan" name="submit_user" id="subject">Submit</button> <button type="submit" class="btn btn-raised">Cancel</button> </div> <span> <?php if(isset($_GET['msg'])) echo $_GET['msg']; ?> </span> </div> </div> </form>
Calling controllers different methods from view page using codeigniter
I am working on codeigniter project in which viwe page having textboxes, radio buttons and button.I fetched textbox values from database and manually enter from date and to date then by clicking on save button insert query gets empty values because in controller i called all functions serially in index function.What is the best solution to call controller methods on each event of view page? leave_appl_view.php <form action="leave_apply_control/index" method="post" id="myForm"> <div class="row"> <div class="col-md-3"> <div class="form-group label-floating"> <label class="control-label">Emp ID</label> <?php if(!empty($emp_leave)) { foreach ($emp_leave as $liv) { ?> <input type="text" class="form-control" name="id" value="<?php echo $liv->employee_id ?>" > </div> </div> <div class="col-md-4"> <div class="form-group label-floating"> <label class="control-label">Employee Name</label> <input type="text" class="form-control" name="empname" id="empname" value="<?php echo $liv->employee_name ?>" > </div> </div> <div class="col-md-4"> <div class="form-group label-floating"> <label class="control-label">Email address</label> <input type="email" class="form-control" name="empmail" id="empmail" value="<?php echo $liv->email ?>" > </div> </div> </div> <div class="row"> <div class="col-md-4"> <div class="form-group label-floating"> <label class="control-label">Leave type: </label> <input type="radio" id="half" name="type" onclick="Checkradiobutton()" value="half"> Half Day <input type="radio" id="full" name="type" onclick="Checkbutton()" value="full" Checked> Full Day </div> </div> <div class="col-md-3"> <div class="form-group label-floating" id="frm_dt"> <label class="control-label">From Date: </label> <input type="text" class="form-control" id="datepicker1" name="from" ></p> </div> </div> <div class="col-md-3"> <div class="form-group label-floating" id="to_dt"> <label class="control-label">To Date: </label> <input type="text" class="form-control" id="datepicker2" name="to" ></p> </div> </div> </div> <div class="row"> <div class="col-md-3"> <div class="form-group label-floating"> <label class="control-label">Balance Leaves</label> <input type="text" class="form-control" name="bal_leave" value="<?php echo $liv->balanced_leaves ?>" > </div> <?php } } ?> </div> <div class="col-md-3"> <div class="form-group label-floating"> <label class="control-label">Applied Leaves</label> <input type="text" class="form-control" name="totaldays" id="totaldays" readonly> </div> </div> <div class="col-md-3"> <div class="form-group label-floating"> <label class="control-label">Applied Date</label> <input type="text" class="form-control" name="todayDate" id="todayDate" value="<?php echo date("d/m/Y"); ?>" readonly> </div> </div> </div> <div class="row"> <div class="col-md-7"> <div class="form-group label-floating"> <label class="control-label">Reason </label> <TEXTAREA class="form-control" id="reason" name="reason"> </TEXTAREA> </div> </div> </div> <button type="submit" class="btn btn-primary" id="submit" name="submit" onclick="<?php // echo base_url() ?>leave_apply_control/save_data">Apply</button> <button type="reset" class="btn btn-primary" onclick="<?php echo base_url();?>leave_apply_control" >Reset</button> </form> leave_Apply_control.php <?php class leave_apply_control extends CI_Controller { public function __construct() { parent::__construct(); $this->load->helper(array('form','url')); $this->load->library(array('session', 'form_validation')); $this->load->library('calendar'); $this->load->database(); $this->load->model('user_model'); $this->load->helper('date'); }//contruct close function index() { $id=$this->session->userdata('id'); $data['foren_id'] = $this -> user_model -> get_emp_id($id); foreach($data['foren_id'] as $fk) { //echo "////control page fk is ".$fk->emp_id; } $data2['emp_leave'] = $this->user_model->get_leave_count($fk->emp_id); $this->load->view('leave_application',$data2); $this->save_data(); } public function save_data() { $fd = date('Y-m-d',strtotime($this->input->post('from'))); $td = date('Y-m-d',strtotime($this->input->post('to'))); $data = array( 'employee_id' => $this->input->post('id'), 'emp_name' => $this->input->post('empname'), 'leave_from' => $fd, 'leave_to' => $td, 'no_of_days' => $this->input->post('totaldays'), 'applied_date' => date('Y-m-d H:i:s'), 'reason' => $this->input->post('reason'), 'mail' => $this->input->post('empmail'), 'leave_type' => $this->input->post('type'), 'balance_leaves' => $this->input->post('bal_leave'), 'status' => 1, ); $this->user_model->insert_leave($data); } }
How can I send mail of complete form in php?
i am having a problem in sending mail to my server. i dont know why the problem is occurring? everything is done perfect but it is not working maybe the fields are not filling properly and alert message is also not shown if(isset($_POST['uname']) && isset($_POST['fname']) && isset($_POST['nic']) && isset($_POST['pecno'])&& isset($_POST['quality[25]'])&& isset($_POST['bday'])&& isset($_POST['quality[26]'])&& isset($_POST['postal'])&& isset($_POST['cell'])&& isset($_POST['houseno'])&& isset($_POST['mail'])&& isset($_POST['city'])&& isset($_POST['province'])&& isset($_POST['country']) ) { $_Name = $_POST['uname']; $_Fname = $_POST['fname']; $_NIC = $_POST['nic']; $_Pecno = $_POST['pecno']; $_Gender = $_POST['quality[25]']; $_Bday = $_POST['bday']; $_Qualification = $_POST['quality[26]']; $_Postal = $_POST['postal']; $_Cell = $_POST['cell']; $_Houseno = $_POST['houseno']; $_Email = $_POST['mail']; $_City = $_POST['city']; $_Province = $_POST['province']; $_Country = $_POST['country']; if(!empty($_Name) && !empty($_Fname) && !empty($_NIC) && !empty($_Pecno)&& !empty($_Gender)&& !empty($_Bday)&& !empty($_Qualification)&& !empty($_Postal)&& !empty($_Cell)&& !empty($_Houseno)&& !empty($_Email)&& !empty($_City)&& !empty($_Province)&& !empty($_Country)) { $to = 'info#mymail.com'; $subject = 'Join us mail'; $body = 'Sender Name : '.$_Name."\n".'Sender Father Name : '.$_Fname."\n".'Sender NIC : '.$_NIC."\n".'Sender PEC Number : '.$_Pecno."\n".'Sender Gender : '.$_Gender."\n".'Sender Birthday : '.$_Bday."\n".'Sender Qualification : '.$_Qualification."\n".'Sender Postal Address : '.$_Postal."\n".'Sender Cell Number : '.$_Cell."\n".'Sender House Number : '.$_Houseno."\n".'Sender Email : '.$_Email."\n".'Sender City : '.$_City."\n".'Sender Province : '.$_Province."\n".'Sender Country : '.$_Country; $header = 'From : '.$_Email; if(#mail($to, $subject, $body, $header)) { echo '<script language="javascript">'; echo 'alert("message successfully sent")'; echo '</script>'; }else { echo 'Please Try again in a few mints !'; } } } html code <form method="POST" action="index.php"> <div class="row"> <div class="col-sm-6 form-group"> <input class="form-control" id="uname" name="uname" placeholder="Name" type="text" required> </div> <div class="col-sm-6 form-group"> <input class="form-control" id="fname" name="fname" placeholder="Father Name" type="text" required> </div> </div> <div class="row"> <div class="col-sm-6 form-group"> <input class="form-control" id="nic" name="nic" placeholder="CNIC/Passport Number" type="text" required> </div> <div class="col-sm-6 form-group"> <input class="form-control" id="pecno" name="pecno" placeholder="PEC Number" type="text"> </div> </div> <div class="row"> <div class="col-sm-6 form-group"> <input class="form-control" id="designation" name="designation" placeholder="Designation" type="text" required> </div> <div class="col-sm-6 form-group"> <input class="form-control" id="organization" name="organization" placeholder="Organization" type="text"> </div> </div> <div class="row"> <div class="col-sm-6 form-group"> Gender: <div class="btn-group" data-toggle="buttons"> <label class="btn btn-default"> <input type="radio" id="quality[25]" name="quality[25]" value="1" /> Male </label> <label class="btn btn-default"> <input type="radio" id="quality[25]" name="quality[25]" value="2" /> Female </label> </div> </div> <div class="col-sm-6 form-group"> <input class="form-control" type="text" onfocus="(this.type='date')" id="bday" name="bday" placeholder="Date of Birth" ><br> </div> </div> <div class="row"> <div class="col-sm-6 form-group"> Qualification: <div class="btn-group" data-toggle="buttons"> <label class="btn btn-default"> <input type="radio" id="quality[26]" name="quality[26]" value="1" /> Bachelors In Engineering </label> <label class="btn btn-default"> <input type="radio" id="quality[26]" name="quality[26]" value="2" /> Masters </label> <label class="btn btn-default"> <input type="radio" id="quality[26]" name="quality[26]" value="3" /> PhD </label> </div> </div> <div class="col-sm-6 form-group"> <input class="form-control" id="postal" name="postal" placeholder="Postal Address" type="text" > </div> </div> <div class="row"> <div class="col-sm-6 form-group"> <input class="form-control slideanim" id="cell" name="cell" placeholder="Cell Number" type="tel" required> </div> <div class="col-sm-6 form-group"> <input class="form-control" id="houseno" name="houseno" placeholder="House Number" type="tel" required> </div> </div> <div class="row"> <div class="col-sm-6 form-group"> <input class="form-control slideanim" id="mail" name="mail" placeholder="Email Address" type="email" required> </div> <div class="col-sm-6 form-group"> <input class="form-control" id="city" name="city" placeholder="City" type="text" required> </div> </div> <div class="row"> <div class="col-sm-6 form-group"> <input class="form-control" id="province" name="province" placeholder="Province/State" type="text" required> </div> <div class="col-sm-6 form-group"> <input class="form-control" id="country" name="country" placeholder="Country" type="text" required> </div> </div> </div> </div> <div class="container"> <div class="row"> <div class="col-sm-12 form-group"> <button class="btn btn-default pull-right " type="submit">Send</button> </div> </div> </div>
replace #mail with mail if(#mail($to, $subject, $body, $header)) enable error reporting error_reporting(E_ALL); Show last error with: print_r(error_get_last()); and check php_error.log for a problem phpinfo(); for checking if mail module is enabled in php. If all pass, check /var/log/mail about the messages, here could be 1001 issues with network, server, firewall etc... hope it helps.
As you mentioned that same code is working perfectly on other page so please check it by removing "#" from mail as adding this will hide all notices and it will display error as well. Also try to print mail body text before mail function.
Reset button using JavaScript is not working after validating the form using Ajax
I have a "create user"form with reset and create button. This reset button is not working for some drop-downs in the form. In addition, reset button is not clearing all the values in the form after validation. It only clears the values entered after validation. Here is my code: <div class="form-action clearfix"> <button type="button" onClick="clearForm()" > Reset </button> <button class="button" type="button" id="button" onclick="doAjax('index.php/users/createUser', convertFormJson('#createUserForm'));">Create</button> and function clearForm() { document.getElementById('createUserForm').reset(); } Form: <?php echo validation_errors(); ?> <div class="container_12 clearfix leading" > <div class="grid_12"> <!--<form class= "form has-validation">--> <?php $attributes = array('class' => 'form has-validation', 'id' => 'createUserForm'); echo form_open('/users/createUser', $attributes); ?> <div class="clearfix"> <label for="form-name" class="form-label">First Name <em>*</em></label> <div class="form-input"> <input type="text" id="form-name" name="firstname" required="required" placeholder="Enter the first name" value="<?php echo set_value('firstname'); ?>" /> </div> </div> <div class="clearfix"> <label for="form-name" class="form-label">Last Name <em>*</em></label> <div class="form-input"> <input type="text" id="form-name" name="lastname" required="required" placeholder="Enter the last name" value="<?php echo set_value('lastname'); ?>"/> </div> </div> <div class="clearfix"> <label for="form-email" class="form-label">Email <em>*</em></label> <div class="form-input"><input type="email" id="form-email" name="email" required="required" placeholder="A valid email address" value="<?php echo set_value('email'); ?>"/></div> </div> <!-- <div class="clearfix"> <label for="form-birthday" class="form-label">Birthdate</label> <div class="form-input"><input type="date" id="form-birthday" name="date" placeholder="mm/dd/yyyy" value="<?php //echo set_value('date'); ?>" class="date"/></div> </div> --> <div class="clearfix"> <label for="form-username" class="form-label">Username <em>*</em></label> <div class="form-input"> <?php echo form_error('username'); ?> <input type="text" id="form-username" name="username" value="<?php echo set_value('username'); ?>" required="required" maxlength="30" placeholder="Alphanumeric (max 30 char.)" /> </div> </div> <div class="clearfix"> <label for="form-password" class="form-label">Password <em>*</em></label> <div class="form-input"> <?php echo form_error('password'); ?> <input type="password" id="form-password" name="password" value="<?php echo set_value('password'); ?>" maxlength="30" placeholder="Min 8 char. containing a capital, number and/or symbol" /> </div> </div> <div class="clearfix"> <label for="form-password-check" class="form-label">Password check <em>*</em></label> <div class="form-input"> <?php echo form_error('passconf'); ?> <input type="password" id="form-password-check" name="passconf" value="<?php echo set_value('passconf'); ?>" data-equals="password" maxlength="30" placeholder="Re-enter your password" /> </div> </div> <div class="clearfix"> <label for="form-group" class="form-label">Group <em>*</em></label> <div class="form-input"> <?php $groupsData[' '] = "--"; $groupJs = 'id="form-group"'; echo form_dropdown('groupId', $groupsData,' ',$groupJs); ?> </div> </div> <div class="clearfix"> <label for="form-language" class="form-label" >Language <em>*</em></label> <div class="form-input"> <select id="form-language" name="language"> <option value ="" > -- </option> <option value ="1">English</option> <option value ="2">French</option> </select> </div> </div> <div class="clearfix"> <label for="form-timezone" class="form-label" >Timezone <em>*</em></label> <div class="form-input"> <?php echo timezone_menu('UM5', 'form-timezone'); ?> </div> </div> Please help me out.