Mit Onclick Array Werte in verschiedene Input felder ablegen

07/28/2015 19:30 Givemoney#16
Nein, keine Fehlermeldungen.

Evtl hier eine livebild.
[Only registered and activated users can see links. Click Here To Register...]

Login Daten.

[Only registered and activated users can see links. Click Here To Register...]
test

oder hier FTP Daten:
ID:212.224.114.19
Benutzer:test
PW: lol44

In der Suche muss Computer eingegeben werden.

Gerne vergebe ich auch eine Login für den FTP. Falls jemand echt so nett wäre und den Fehler suchen würde.



Es geht gerade nur Rechnung Aritkel suche alles andere habe ich nicht angepasst, dar ich eig alles local mache. Wie du siehst übernimmt er das nicht. Hier die alten Orginal Scripte:

auswahl.php

PHP Code:
 <!-- Login Session  Anfang -->
<?php
session_start
();
include_once 
'dbconnect.php';
if(!isset(
$_SESSION['user']))
{
header("Location: index.php");
}
$res=mysql_query("SELECT * FROM users WHERE user_id=".$_SESSION['user']);
$userRow=mysql_fetch_array($res);
?>
<html>
   <head>

   <style>
                   .article{
                        list-style:none;
                }
                .article > li{cursor:pointer;}
                .article > li:nth-of-type(2n+1){

                }
                .article >li:hover{
                        color:red;
                }
   </style>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>


  </head>


   <body>




<?php

$s 
= ($_GET['s']);

$con = mysqli_connect('localhost','Givemoney','Itsmylife44','justin');
if (!
$con) {
die(
'Could not connect: ' . mysqli_error($con));
}

$rows = array();

mysqli_select_db($con,"parameter");
$sql="SELECT * FROM article WHERE description = '".$s."'";
$result = mysqli_query($con,$sql);

 echo 
"<br>";



while(
$row = mysqli_fetch_array($result)) {
$rows[] = $row;

       echo
"<ul class='article'>";
                echo
"<li data-idart=".$row["description"].",".$row["idart"].",".$row["price"].",".$row["supplier"].">".$row["description"].",".$row["idart"].",".$row["price"].",".$row["supplier"]."</li>";

        echo
"</ul>";


      echo 
"<br>";
 }
  echo 
"<br>";



 foreach (
$rows as $row) {




}

echo 
"<br>";

        
$test = "ha�";

mysqli_close($con);

   
?>

        <body>
    <ul class="article">
                <li data-idart="1">Artikel mit ID 1</li>
                <li data-idart="2">Artikel mit ID 2</li>
                <li data-idart="3">Artikel mit ID 3</li>
        </ul>

             -->
        <form method="post">
                <input id="ids" type="text" name="ids"/>
                <input type="submit" value="Submit"/>
        </form>

        </body>


      <script>
         (function( $ ) {
                        var list = new Array();
                        $.fn.tag = function( action ) {
                           if( action == "initialize"){
                                        return this.each(function(){
                                                var obj = $( this );
                                                obj.click(function(){
                                                        testList(obj.attr("data-idart"));
                                                        $("#ids").val(list.join("|"));
                                                });
                                        });
                           };

                                function testList($id){
                                        var index = $.inArray( $id, list );
                                        if(index  >= 1)
                                                list.splice(index,1); /* remove from list */
                                        else
                                                list.push($id);
                                };
                        };

                }( jQuery ));
                $("ul.article > li").tag("initialize");
                </script>

















    <!-- hidden Atribut zur Veranschaulichung weggelassen -->
   <!-- // $i =0;
 // $i++;
//"<th>TB Namen";

      //echo "<ul class='article'>"     ;
    //echo "<li data-idart='1'>test</li>";

        <!-- <select name='Eingabe1' onchange='var r = document.forms[0].Eingabe1.selectedIndex; document.forms[0].Ausgabe1.value=document.forms[0].Eingabe1.options[r].value;' >
<!-- Ausgabe mit Namen-->


<!-- Form wird an "insertnew.php" geschickt-->

<!-- Javascript holt die Daten von "getuser2.php" und getarticle.php-->

   <!--<?php
$s 
= ($_GET['s']);

$con = mysqli_connect('localhost','Givemoney','Itsmylife44','justin');
if (!
$con) {
die(
'Could not connect: ' . mysqli_error($con));
}

$rows = array();

mysqli_select_db($con,"parameter");
$sql="SELECT * FROM article WHERE description = '".$s."'";
$result = mysqli_query($con,$sql);

 echo 
"<br>";



while(
$row = mysqli_fetch_array($result)) {
$rows[] = $row;
echo 
'<option value = '.$row["description"].",".$row["idart"].",".$row["price"].",".$row["supplier"]. '>' .$row["idart"] . " " .$row["description"]." " .$row["price"]. "</option>";





 }

 foreach (
$rows as $row) {

}

echo 
"<br>";

echo 
'</select>';

echo 
"<br>";



mysqli_close($con);
?>

<?php echo "<input type='' name='Ausgabe1' value='Ausgabe1'></input>"; ?>  -->

  <!--  //onclick=document.getElementById('Ausgabe2').value='".$row["idart"].",".$row["description"].",".$row["price"].",".$row["supplier"]."'

//echo "</ul>" ;

 //echo "<p align='center'><table><tr><td onclick=document.getElementById('Ausgabe2').value='".$row["idart"].",".$row["description"].",".$row["price"].",".$row["supplier"]."'>".$row["description"]."".$row["price"]."</td></tr></table></p>";


//echo "<input id='ids' type='text' name='ids'/>" ;
               // echo "<p align='center'><input class='textfield' type='text' value='' name='Ausgabe2' id='Ausgabe2'></p> ";
               // echo "<p align='center'><input class='textfield' type='text' value='' name='Ausgabe3' id='Ausgabe3'></p> ";


 // echo("<option onclick=document.getElementById('Ausgabe2').value='".$row["idart"].",".$row["description"].",".$row["price"].",".$row["supplier"]."'>".$row['description']."".$row['price']."</option>");



//echo"<td onclick=document.getElementById('Ausgabe3').value='".$row["idart"].",".$row["description"].",".$row["price"].",".$row["supplier"]."'>".$row["description"]."".$row["price"]."</td><br>";
//if($i==10 );
//"</th>";
   <!-- //echo "<p align='center'><table><tr><td onclick=document.getElementById('Ausgabe2').value='".$row["idart"].",".$row["description"].",".$row["price"].",".$row["supplier"]."'>".$row[1]."".$row["price"]."</td></tr></table></p>";
//echo "<p align='center'><table><tr><td onclick=document.getElementById('Ausgabe3').value='".$row["idart"].",".$row["description"].",".$row["price"].",".$row["supplier"]."'>".$row["description"]."".$row["price"]."</td></tr></table></p>";

    <!--<input class="textfield" type="text" value="" name="" id="test0">
     <input class="textfield" type="text" value="" name="" id="test1">
 <table><tr>
<td  value="hallo" onclick="document.getElementById('test0').value='Computer';">test1</td>
<td value='sdsd'; onclick="document.getElementById('test1').value='Stromkabel';">test2</td>
</tr></table>
 <
<?php echo "<input type='' name='Ausgabe' value='Ausgabe'></input>"; ?>


<!-- fieldset ende-->

     <!--//echo "<p align='center'><table><tr><td onclick=document.getElementById('Ausgabe2').value='".$row["idart"].",".$row["description"].",".$row["price"].",".$row["supplier"]."'>".$row[1]."".$row["price"]."</td></tr></table></p>";
       //echo "<p align='center'><table><tr><td onclick=document.getElementById('Ausgabe2').value='".$row["idart"].",".$row["description"].",".$row["price"].",".$row["supplier"]."'>".$row["description"]."".$row["price"]."</td></tr></table></p>";
//echo "<p align='center'><table><tr><td onclick=document.getElementById('Ausgabe2').value='".$row["idart"].",".$row["description"].",".$row["price"].",".$row["supplier"]."'>".$row["description"]."".$row["price"]."</td></tr></table></p>";
//echo "<p align='center'><table><tr><td onclick=document.getElementById('Ausgabe3').value='".$row["idart"].",".$row["description"].",".$row["price"].",".$row["supplier"]."'>".$row["description"]."".$row["price"]."</td></tr></table></p>";
 //echo $row[1];


//echo '</select>';
     ';


<!--<table><tr>
<!--<td style="background-color:#CCFF66; width:20px; height:20px;" onclick="document.getElementById('color').value='#CCFF66';"></td>
<td style="background-color:#009999; width:20px; height:20px;" onclick="document.getElementById('color').value='#009999';"></td>
</tr></table>  -->


<!-- Rest Code -->
<!-- <p align="center">Artikel:<input name="Article" value="" onchange="showArticle(this.value)">  </p>  -->
<!-- <div align="center" id="Artikel" name"test3">DivArt</div>   -->
<!-- hidden Content -->
<!--   PopUp Function   -->
<!--<script>
function popup(URL) {
w = window.open(URL, "", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=650,height=500,left = 390,top = 262");
}
</script>
<!--<body onLoad="javascript:popup('Impressum.php')"> -->
<!--<p align="center"><label></label> <select name="auswahl" id='myselect' onchange="document.getElementById('myhidden').value=this.value"> </p>
<!-- Select Anfrage <?php
$db_server 
= 'localhost';
$db_name = 'justin';
$db_user = 'Givemoney';
$db_passwort = 'Itsmylife44';
$db = @ mysql_connect ( $db_server, $db_user, $db_passwort )
or die ( 
'Konnte keine Verbindung zur Datenbank herstellen' );
$db_check = @ mysql_select_db ( $db_name );
if ( 
$db )
{
echo 
'Verbindung zur Datenbank wurde hergestellt';
}
$sql = "SELECT lastname FROM adress";
$result = mysql_query($sql) OR die(mysql_error());
while(
$row = mysql_fetch_assoc($result)) {
echo(
"<option>".$row['lastname']."</option>");
}
?>
<p align="center"><a href ="javascript:popup('auswahl.php')" > Artikel ausw�hlen</a>    </p>    -->
</html>

Rechnung.php

PHP Code:
<!-- Login Session  Anfang -->
<?php
session_start
();
include_once 
'dbconnect.php';
if(!isset(
$_SESSION['user']))
{
header("Location: index.php");
}
$res=mysql_query("SELECT * FROM users WHERE user_id=".$_SESSION['user']);
$userRow=mysql_fetch_array($res);
?>
<html>
<head>
<!-- Formatierung -->
<link href="style.css" rel="stylesheet" type="text/css" />
<title>Golder GmbH</title>
</head>
<div id="container" align="center">
<div id="header">
<h1>Warenwirtschaft</h1>
<!--  Navigation -->
<div id="nav"
<a href="home.php"></a><a href="home.php">Home</a><a href="Neuerkunde.php">Neuer Kunde</a><a href="artikel1.php">Arikel</a><a href="Rechnung.php">Rechnung</a><a href="logout.php?logout">Logout</a>
</div>
</div>
<div id="content">
<br><br>
<body>
<!-- fieldset -->
<fieldset>
<!-- Ausgabe mit Namen-->
<div id='erstellt'>Neuer Rechnung wird erstellt von: <?php echo "<b>".$userRow['username']."</b>"; ?>  </div>
<h2><p align="center">Rechnung erstellen</p></h2>
<!-- Form wird an "insertnew.php" geschickt-->
<form action="insertnew.php" return false; method="POST">
<!-- Javascript holt die Daten von "getuser2.php" und getarticle.php-->
<script>function showUser(str) {
    if (str == "") {
        document.getElementById("Daten").innerHTML = "";
        return;
    } else {
        if (window.XMLHttpRequest) {
            // code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        } else {
            // code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                document.getElementById("Daten").innerHTML = xmlhttp.responseText;
            }
        }
        xmlhttp.open("GET","getuser2.php.php?q="+str,true);
        xmlhttp.send();
    }
}
         function showArticle(str) {
    if (str == "") {
        document.getElementById("Artikel").innerHTML = "";
        return;
    } else {
        if (window.XMLHttpRequest) {
            // code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        } else {
            // code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                document.getElementById("Artikel").innerHTML  = xmlhttp.responseText;
            }
        }
        xmlhttp.open("GET","auswahl.php?s="+str,true);
        xmlhttp.send();
    }
}



// Popup Funktion
function popup(URL) {
w = window.open(URL, "", "width=770,height=500,left = 250,top = 262");
}
</script>


<!--<script type='text/javascript' src='jquery-2.1.3.js'></script>




  <link rel="stylesheet" type="text/css" href="/css/result-light.css">

  <style type='text/css'>
    .article{
    list-style:none;
}
.article > li{cursor:pointer;}
.article > li:nth-of-type(2n+1){

}
.article >li:hover{
    color:red;
}
  </style>     -->



<!-- <script type='text/javascript'>//<![CDATA[
$(document).ready(function(){
 (function( $ ) {
    var list = new Array();
    $.fn.tag = function( action ) {
       if( action == "initialize"){
            return this.each(function(){
                var obj = $( this );
                obj.click(function(){
                    testList(obj.attr("data-idart"));
                    $("#ids").val(list.join("|"));
                });
            });
       };

        function testList($id){
            var index = $.inArray( $id, list );
            if(index  >= 1)
                list.splice(index,1); /* remove from list */
            else
                list.push($id);
        };
    };

}( jQuery ));
$("ul.article > li").tag("initialize");
});//]]>

</script>    -->


<!-- </head>
<body>
  <ul class="article">
    <li data-idart="Artikel1">Artikel mit ID 1</li>
    <li data-idart="Artikel12">Artikel mit ID 2</li>
    <li data-idart="Artikel3">Artikel mit ID 3</li>
</ul>    -->

<!-- hidden Atribut zur Veranschaulichung weggelassen -->
<!-- <form method="post">
    <input id="ids" type="text" name="ids"/>
    <input type="submit" value="Submit"/>
</form>-->

<!-- Suchfunktion f�r die Personen-->

<p align="center"><input class="user" name="user" value="" placeholder="Kunde suchen"  onchange="showUser(this.value)"></p>
<!-- Ausgabe f�r das Dropdown Men� mit den Personen-->
<div id="Daten"  align="center" name"test2"></div>
<p align="center"><input class="user" name="artikel" value="" placeholder="Artikel suchen"  onchange="showArticle(this.value)"></p>
<!-- Ausgabe f�r das Dropdown Men� mit den Personen-->
<div id="Artikel"  align="center" name"test3"></div>

<!-- Input Eingabe -->
<p align="center"><input type=button value="Artikel ausw�hlen"onclick="javascript:popup('auswahl.php')" > </a></button>    </p>
<p align="center">
<input class="kunde" name="article" required="required" placeholder="nicht beachten" type="text"></p>
</p>
<p align="center">
<input class="kunde" name="count" required="required" placeholder="nicht beachten" type="text"></p>
</p>
<p>
<p align="center">
<input class="kunde" name="price" required="required" placeholder="nicht beachten" type="text"></p>
</p>
<p align="center">
<input class="kunde" name="ust" required="required" placeholder="nicht beachten" type="text"></p>
</p>
<p align="center">
<input type="hidden" name="test" required="required" placeholder="nicht beachten" type="text"></p>
</p>
</select>
<p><p align="center"><input class="sende01" type='submit' id='' value='Senden'> <input class="sende01" value="L�schen" type="reset"></p>
</form>
<!-- fieldset ende-->
</fieldset>
</div>
<!-- Hier beginnt der Footer berreich [Fu�zeile]-->
<div id="footer">
<a href="Impressum.php">Impressum</a>
</div>
</div>
</body>
<!-- Rest Code -->
<!-- <p align="center">Artikel:<input name="Article" value="" onchange="showArticle(this.value)">  </p>  -->
<!-- <div align="center" id="Artikel" name"test3">DivArt</div>   -->
<!-- hidden Content -->
<!--   PopUp Function   -->
<!--<script>
function popup(URL) {
w = window.open(URL, "", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=650,height=500,left = 390,top = 262");
}
</script>
<!--<body onLoad="javascript:popup('Impressum.php')"> -->
<!--<p align="center"><label></label> <select name="auswahl" id='myselect' onchange="document.getElementById('myhidden').value=this.value"> </p>
<!-- Select Anfrage <?php
$db_server 
= 'localhost:3307';
$db_name = 'justin';
$db_user = 'root';
$db_passwort = '1234';
$db = @ mysql_connect ( $db_server, $db_user, $db_passwort )
or die ( 
'Konnte keine Verbindung zur Datenbank herstellen' );
$db_check = @ mysql_select_db ( $db_name );
if ( 
$db )
{
echo 
'Verbindung zur Datenbank wurde hergestellt';
}
$sql = "SELECT lastname FROM adress";
$result = mysql_query($sql) OR die(mysql_error());
while(
$row = mysql_fetch_assoc($result)) {
echo(
"<option>".$row['lastname']."</option>");
}
?>
<p align="center"><a href ="javascript:popup('auswahl.php')" > Artikel ausw�hlen</a>    </p>    -->
</html>
07/28/2015 21:32 snow#17
#closed (on request)