Javasript

Irgendwelche Probleme mit XAMPP für Linux? Dann ist hier genau der richtige Ort um nachzufragen.

Javasript

Postby Deejoy » 16. July 2004 14:01

Hi,
ich habe ein Javasript was bisher auch überall lief. Nur auf dem Linux root wo ich Xammp installiert habe will es einfach nicht. Auf Windows läuft es unter Xampp.

Hier mal das Sript

Code: Select all
<script type="text/javascript">
<!--
function show_location(objInput)
{
if(!String(objInput.value).match(/^\d{5}$/))
    {
    objInput.form.ort.style.visibility="hidden";
    }
else
    {
    window.dummie.location="plz.php?plz="+objInput.value;
    }
}
function add_option(strText)
{
objList=document.frm.ort;
objList.options[objList.options.length]=new Option(strText);
if(!window.opera)
    {
    objList.size=objList.options.length;
    }
objList.style.visibility='visible';
}
//-->
</script>


<form name='frm'>
<iframe src='plz.php'name='dummie'width='1'height='1'frameborder='0'style='visibility:hidden;'></iframe>
<center>
<b>PLZ:<b><br><input size='5'type='text'maxlength='5'name='plz_in'onkeyup='show_location(this)'><br>
<select name='ort'style='visibility:hidden'>
<option>?</option>
</select>
</form>


Zur kurzen Erklärung. Man gibt seine Postleitzahl ein und anhand dieser wird aus der Datenbank dann der passende Ort rausgesucht und angezeigt.
Hier die Datenbankanbindung
Code: Select all
<script type="text/javascript">
<!--

function get_location()
{
if(typeof parent.dummie=='object' && typeof parent.document.frm.ort=='object')
    {
    objList = parent.document.frm.ort;
    objList.options.length=0;
<?php

    //Wurde Parameter übergeben?
    if(isset($_GET['plz']))
        {
include ('inc/config.php');
@mysql_connect($sqlhost,$sqluser, $sqlpwd) OR die(mysql_error());   
mysql_select_db($db_name) OR die(mysql_error());           
$sql = "select ort from plz where plz='$_GET[plz]'";
$result= mysql_query($sql) OR die(mysql_error());

        while($row = mysql_fetch_array($result))
            {
            echo "\n\tparent.add_option('".$row['ort']."');";
            }
        }
       ?>

    }
}
if(self==top)
    {
    document.location='index.php';
    }
else
    {
    get_location();
    }
//-->
</script>


Also die Datenbank ist vorhanden. Zugriff darauf habe ich auch
Deejoy
 
Posts: 26
Joined: 15. July 2004 21:29

Postby DaHipster » 07. August 2004 11:59

Mein Senf:
Hi Deejoy,
sehr interessante Konstruktion.

Vielleicht klappt´s, wenn Du dir die Zeile:
$sql = "select ort from plz where plz='$_GET[plz]...
nochmal genau anschaust?

Tipp: $_GET['plz']
DaHipster
 
Posts: 9
Joined: 07. August 2004 11:06

Postby Deejoy » 07. August 2004 15:32

Ja danke mitlerweile läuft es :)
Deejoy
 
Posts: 26
Joined: 15. July 2004 21:29


Return to XAMPP für Linux

Who is online

Users browsing this forum: No registered users and 7 guests