Script URL:
Version of script:
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:
Write your message below:
In my situation all the tickets are input by the operators, they have to imput the caller's name and email, now they manually search in a asp page to get the name and email (in oracle db). I want to integrate it in hesk, input the name, then search in oracle return the email address automatically in email field.
How to do it?
thanks
Eagle
How to auto populate text input field value from db
Moderator: mkoch227
-
- Posts: 94
- Joined: Wed Feb 29, 2012 2:00 am
How to auto populate text input field value from db
Last edited by deserteagle369 on Sat Mar 31, 2012 2:35 am, edited 1 time in total.
Eagle
Life is a journey.
Life is a journey.
Re: How to search email in oracle db and return it
I'm afraid such custom integrations are out of the scope of my support there. You will need to ask/hire a programmer with PHP and Oracle experience.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
-
- Posts: 94
- Joined: Wed Feb 29, 2012 2:00 am
Re: How to search email in oracle db and return it
I found a piece of js code can query in Oracle and get the value in a array dataEmpInfo(), dataEmpInfo[1] is the Employee No. whick input by user, and dataEmpInfo[8] is the email address, how to put email address into the "Email:" input text area?
Could anyone give me some hint?
Thanks
Eagle
Could anyone give me some hint?
Thanks
Eagle
Eagle
Life is a journey.
Life is a journey.
Re: How to search email in oracle db and return it
Probably something like after the DB query.
Code: Select all
document.form1.email.value=dataEmpInfo[8];
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
-
- Posts: 94
- Joined: Wed Feb 29, 2012 2:00 am
Re: How to search email in oracle db and return it
Afew days study, I figure out the logic like this:
php form -> onkeyup call javascript function -> query by php, then return result to javascript.
In the w3school I found sample to output the result by javascript with echo:
http://www.w3schools.com/php/php_ajax_php.asp
I copy the html and javascript code to mine, but change the gethint.php to query in hb_ticket table, it works when input username it can show the email in suggestion.
but I can't find a way to populate the email to the php form email field area, I try document.form1.email.value= xmlHttp.responseText but it can't work.
php form -> onkeyup call javascript function -> query by php, then return result to javascript.
In the w3school I found sample to output the result by javascript with echo:
http://www.w3schools.com/php/php_ajax_php.asp
I copy the html and javascript code to mine, but change the gethint.php to query in hb_ticket table, it works when input username it can show the email in suggestion.
but I can't find a way to populate the email to the php form email field area, I try document.form1.email.value= xmlHttp.responseText but it can't work.
Eagle
Life is a journey.
Life is a journey.
-
- Posts: 94
- Joined: Wed Feb 29, 2012 2:00 am
Re: How to search email in oracle db and return it
After one week google and study I figured it out.
The process is:
add onfocus event for email input field, add javascript function to handle the trigger and call a php file to query in database, return the result in a text with comma delimiter, then the javascript function will handle the resonse text to put in the form.
To make it simple this time I didn't query in Oracle just query in history hesk_ticket.
1. add 3 functions
index.php
line 87
2. add id for input filed in form1 and onfocus event (it look like it work with name in IE but need id in Firefox and opera)
few lines after the form1, between line 134-138 in original index.php
for name input field
from
to
for email input field
from
to
if you have customer field need auto populate too ( I only try default text input), add id also.
line 386 in original index.php
from
to
3. create a empcheck.php to do the database query, which called by function empcheck()
It return the result in a array, so you need remember the order.
Change the name ,password and database name for your mysql database.
Because it query in hesk_tickets, so if you don't have any ticket no result return, you need add some tickets to test it.
Most scripts are from http://www.crackajax.net/popform.php, but the original script can't work well, I used some days to make it work. Anyway, it's the only one sample can work which meet my auto populate from db requirement.
That's all. Enjoy!
The process is:
add onfocus event for email input field, add javascript function to handle the trigger and call a php file to query in database, return the result in a text with comma delimiter, then the javascript function will handle the resonse text to put in the form.
To make it simple this time I didn't query in Oracle just query in history hesk_ticket.
1. add 3 functions
index.php
line 87
Code: Select all
<html>
<head>
<script>
var url = ""empcheck.php?q="";
//put the result text in form, the query name is in the last.
function handleHttpResponse() {
if (http.readyState == 4) {
results = http.responseText.split("","");
document.getElementById(""email"").value = results[0];
document.getElementById(""custom6"").value = results[1];
document.getElementById(""custom7"").value = results[2];
document.getElementById(""custom8"").value = results[3];
document.getElementById(""custom9"").value = results[4];
document.getElementById(""name"").value = results[5];
}
}
function empcheck() {
var idValue = document.getElementById(""name"").value;
var myRandom=parseInt(Math.random()*99999999); // cache buster
http.open(""GET"", url + escape(idValue) + ""&rand="" + myRandom, true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}
function getHTTPObject() {
var xmlhttp;
/*@cc_on
@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject(""Msxml2.XMLHTTP"");
} catch (e) {
try {
xmlhttp = new ActiveXObject(""Microsoft.XMLHTTP"");
} catch (E) {
xmlhttp = false;
}
}
@else
xmlhttp = false;
@end @*/
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
}
}
return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object
</script>
</head>
</html>
few lines after the form1, between line 134-138 in original index.php
for name input field
from
Code: Select all
<td width="80%"><input type="text" name="name" size="40"
Code: Select all
<td width="80%"><input type="text" name="name" id="name" size="40"
from
Code: Select all
<td width="80%"><input type="text" name="email" size="40"
Code: Select all
<td width="80%"><input type="text" name="email" id="email" onfocus = "empcheck();" size="40"
line 386 in original index.php
from
Code: Select all
<td width="80%"><input type="text" name="'.$k.'" size="40"
Code: Select all
<td width="80%"><input type="text" id="'.$k.'" name="'.$k.'" size="40"
Code: Select all
<?php
$q=$_GET["q"];
$con = mysql_connect('localhost', 'root', 'root');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_set_charset('utf8',$con);
mysql_select_db("hesk23", $con);
if(strlen($q)>0){
$result = mysql_query("SELECT * FROM hesk_tickets WHERE name LIKE '$q%'");
if(mysql_num_rows($result)>=1) {
while($myrow = mysql_fetch_array($result)){
$empname = $myrow["name"];
$empemail = $myrow["email"];
$empcname = $myrow["custom6"];
$empext = $myrow["custom7"];
$empmob1 = $myrow["custom8"];
$empmob2 = $myrow["custom9"];
$textout = $empemail.",".$empcname.",".$empext.",".$empmob1.",".$empmob2.",".$empname;
}
}
else {
$textout=" , , , , ,".$q;
}
}
echo $textout;
?>
Change the name ,password and database name for your mysql database.
Because it query in hesk_tickets, so if you don't have any ticket no result return, you need add some tickets to test it.
Most scripts are from http://www.crackajax.net/popform.php, but the original script can't work well, I used some days to make it work. Anyway, it's the only one sample can work which meet my auto populate from db requirement.
That's all. Enjoy!
Eagle
Life is a journey.
Life is a journey.