Jump to content

schmack

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Everything posted by schmack

  1. Hello… I have a 3 dropdown “boxes” when I pick one of the first option the second one will be showed. >>>> 1.php <<<< ---------------------------------------------------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>!AJAX!</title> <script language="javascript" type="text/javascript"> //------------- <> ------------- var http = getHTTPObject(); function getHTTPObject() { var xmlhttp; if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest(); else if (window.ActiveXObject) xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); return xmlhttp; } //------------- <> ------------- function getDistritos() { var pais = document.getElementById("pais").value; var url = "1.php?pais="; http.open("GET", url + encodeURI(pais) , true); http.onreadystatechange = handleDistritos; http.send(null); } function handleDistritos() { if(http.readyState==4) { if(http.status==200) { var result = http.responseText; if(result!="null") document.getElementById('distrito').innerHTML = result; } } } function getConcelhos() { var pais = document.getElementById("distrito").value; var url = "1.php?distrito="; http.open("GET", url + encodeURI(distrito) , true); http.onreadystatechange = handleConcelhos; http.send(null); } function handleConcelhos() { if(http.readyState==4) { if(http.status==200) { var result = http.responseText; if(result!="null") document.getElementById('concelho').innerHTML = result; } } } </script> </head> <body> <form name="myform" id="myform"> País: <select name="pais" id="pais" onchange="javascript:getDistritos();"> <OPTION value='0' >Pick a country (pais)</OPTION> <?php include './bd.php'; $result=mysql_query("select pais_id, pais_nome from pais;"); while($row = mysql_fetch_array($result)) { echo("<option value='".$row[0]."'>".$row[1]."</option>"); } mysql_close(); ?> </select> Distrito: <select name="distrito" id="distrito" onchange="javascript:getConcelhos();"> <OPTION value='0' >pick a state (distrito)</OPTION> </select> Concelho: <select name="concelho" id="concelho" onchange="javascript:getFrequesias();"> <OPTION value='0' >pick a city (concelho)</OPTION> </select> </form> </body> </html> --------------------------------------------------------------------------- >>>> 2.php <<<< ------------------------------------------------------------------------------- <?php if (($_GET['pais']==1) || ($_GET['pais']==2) || ($_GET['pais']==3)) { include './bd.php'; $result=mysql_query("select distrito_id, distrito_nome from distrito where distrito_id = '$_GET[pais]';"); while($row = mysql_fetch_array($result)) { print("<option value='".$row[0]."'>".$row[1]."</option>"); } mysql_close(); } if (($_GET['distrito']==1) || ($_GET['distrito']==2) || ($_GET['distrito']==3)) { include './bd.php'; $result=mysql_query("select concelho_id, concelho_nome from concelho where concelho_id = '$_GET[distrito]';"); while($row = mysql_fetch_array($result)) { echo("<option value='".$row[0]."'>".$row[1]."</option>"); } mysql_close(); } ?> ------------------------------------------------------------------------------- I can´t even make the second dropdown work properly… Can anyone help me???? Thanks! Thanks! Thanks!
  2. Hello everyone… A bookmark file look like this (a very simple one!):: ----------------------------------------------------------------------- <!DOCTYPE NETSCAPE-Bookmark-file-1> <TITLE>Bookmarks</TITLE> <H1>Bookmarks</H1> <DL><p> <DT><H3 FOLDED ADD_DATE="0000000000">SBm - date</H3> <DL><p> <DT><A HREF="http://www.uidesign.de/index.php?article_id=1&clang=1" >User Interface Design GmbH (UID) - Usability Engineering, Graphic Design, Software Development</A> <DT><A HREF="http://www.usernomics.com/" >User Interface Design, Usability, Human Factors, & Ergonomics</A> </DL><p> </DL><p> ----------------------------------------------------------------------- What I need to do is to get from a database a name of site (site_name) and de link of the site (site_link) and put it in the spotes it has to be in! example::: ----------------------------------------------------------------------- <!DOCTYPE NETSCAPE-Bookmark-file-1> <TITLE>Bookmarks</TITLE> <H1>Bookmarks</H1> <DL><p> <DT><H3 FOLDED ADD_DATE="0000000000">SBm - date</H3> <DL><p> <DT><A HREF="site_link" >site_name</A> <DT><A HREF="site_link" >site_name</A> </DL><p> </DL><p> ----------------------------------------------------------------------- And export it to a file (ex: bookmark.htm). In the [ ADD_DATE=0000000000] I can use <?php date("Y-m-d"); ?> Thanks… a real thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.