innerhtml geen <tr> en <td>
-----------------
Pagina die ik oproek via ajax en de waarde aan doorgeef
-----------------
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php include ("inc_connect.php");//include settings file
$field = $_GET["cust"];
$fieldid = $_GET["id"];
$query = "INSERT INTO customers_req (cus_id,req_id) VALUES ('".$field."','".$fieldid."')";
mysql_query($query) or die(mysql_error());
$select = mysql_query("SELECT * from customers WHERE cus_id = '".$field."'") or die (mysql_error());
//een lus om de gamma's in een listbox te stoppen
while($rowcus = mysql_fetch_array($select))
{
$html .= '<tr class="lightgreen"><td><td> <td>'.$rowcus['cus_surname'].' '.$rowcus['cus_firstname'].'</td></tr>';
}
?>
html = document.getElementById('customershtml');
html.innerHTML =document.getElementById('customershtml').innerHTML + '<?=$html?>';
$field = $_GET["cust"];
$fieldid = $_GET["id"];
$query = "INSERT INTO customers_req (cus_id,req_id) VALUES ('".$field."','".$fieldid."')";
mysql_query($query) or die(mysql_error());
$select = mysql_query("SELECT * from customers WHERE cus_id = '".$field."'") or die (mysql_error());
//een lus om de gamma's in een listbox te stoppen
while($rowcus = mysql_fetch_array($select))
{
$html .= '<tr class="lightgreen"><td><td> <td>'.$rowcus['cus_surname'].' '.$rowcus['cus_firstname'].'</td></tr>';
}
?>
html = document.getElementById('customershtml');
html.innerHTML =document.getElementById('customershtml').innerHTML + '<?=$html?>';
-----------------
Pagina waarin de html moet terecht komen.
-----------------
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//........
<?php
//select join om de namen uit customers te halen via het req_id en cus_id
$select ="SELECT * from customers_req c JOIN customers a ON c.cus_id = a.cus_id WHERE c.req_id ='$reqidedit'";
$result = mysql_query($select) or die(mysql_error());
while($rowcust = mysql_fetch_array($result))
{
echo '<tr class="lightgreen"><td></td><td colspan="3">'.$rowcust['cus_surname'].' '.$rowcust['cus_firstname'].'</td></tr>';
}
?>
<div id="customershtml"></div>
//........
<?php
//select join om de namen uit customers te halen via het req_id en cus_id
$select ="SELECT * from customers_req c JOIN customers a ON c.cus_id = a.cus_id WHERE c.req_id ='$reqidedit'";
$result = mysql_query($select) or die(mysql_error());
while($rowcust = mysql_fetch_array($result))
{
echo '<tr class="lightgreen"><td></td><td colspan="3">'.$rowcust['cus_surname'].' '.$rowcust['cus_firstname'].'</td></tr>';
}
?>
<div id="customershtml"></div>
//........
Gewijzigd op 01/01/1970 01:00:00 door Jasper
Waarom zet je dan geen AJAX op je tabel? Dat die vernieuwd kan worden op ieder moment (misschien wel om de zoveel minuten). Hoef je niet met innerHTML e.d. te gaan werken.