Well.. i have this little problem.. I have one page where.. there's one input.. and then i have to click on one link.. and it opens one popup window.. there i have to select something.. and when i click "use" in this popup window.. it closes this popup window and it inserts this information into input..
maybe someone knows how to do it..![]()
When you click the link execute HTTP Request that connects to a PHP script and submits the data. On return (when your PHP script finishes) close the window using JavaScript.
umm..can you give me a little example? because i'm not good with ajax yet![]()
HTML Code:<a href="#" onClick="close()">Close</a>Code:var xmlHttp function GetXmlHttpObject() { var xmlHttp = null; try { xmlHttp = new XMLHttpRequest(); } catch (e) { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } function close() { xmlHttp = GetXmlHttpObject(); if (xmlHttp == null) { alert ("Your browser does not support AJAX!"); return; } var url_update = "file.php"; url_update = url_update + "?var1=" + document.FORM_NAME.INPUT_NAME1.value; url_update = url_update + "&var2=" + document.FORM_NAME.INPUT_NAME2.value; xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { window.close(); } } xmlHttp.open("GET", url_update, true); xmlHttp.send(null); }untested...Code:mysql_query("INSERT INTO `db` (`var1`, `var2`) VALUES($_GET['var1'], $_GET['var2'])");
Last edited by John; 07-14-2008 at 01:55 PM.
wait.. what it should do?
hmmm yes it can be done by here....
_________________________
fodbold spil Desktop sharing and PowerPoint sharing with video conferencing
Basically sends two GET input to file.php. So if your Form's input_name1 textbox is A and input_name2 textbox is B. It requests the server via Ajax "file.php?var1=A&var2=B"Code:var url_update = "file.php"; url_update = url_update + "?var1=" + document.FORM_NAME.INPUT_NAME1.value; url_update = url_update + "&var2=" + document.FORM_NAME.INPUT_NAME2.value;
This belongs to the file.php. Asks mysql to save the two variables into the database. Obviously won't work tho, you are lacking mysql_connect and mysql_select_db.Code:<? mysql_query("INSERT INTO `db` (`var1`, `var2`) VALUES($_GET['var1'], $_GET['var2'])"); ?>
You could try this...
The contents of the iframe could call a function with an onlcick event handler...Code:var newframe = document.createElement("IFRAME"); document.body.appendChild(newframe); newframe.location.replace('http://mydomain.com/mypage.html');
HTML Code:<a href="#" onclick="top.newframe.style.display = 'none';">Click Me></a>
Last edited by Jaan; 07-30-2008 at 05:46 AM. Reason: Use tags when you're posting your codes..
hmm.. I'm not stupid but i still can't get it.. I believe if I don't understand it now then I don't need it now.. so this means I have to use another way.. :/
hmm.. maybe noone have really understood your question?
I have a guess how you mean:
you have an ordinary text input that you want to fill with a value, either you can write the value, or, you want ppl to be able to seach for them, so if they want to search, they klick an adjacent button and gets a new popup window with a search function.
when they have fount the hot they want, they choose it by clicking a button in this popup button, which closes the popup and enters the correct value into the base page input?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks