hi,
i have a problem with my php+javascript, and i am new to both. the script takes input, and displays them into separate tables. i following script does a part of what i wanted to do, ie, it deletes the table sitting inside another one as a row, but it does it for just the first one if i have, lets say, 3 input. the two other delete buttons don't work at all. please help me figure out what's wrong, and how can i fix it.
thanks a lot in advance.
i have a problem with my php+javascript, and i am new to both. the script takes input, and displays them into separate tables. i following script does a part of what i wanted to do, ie, it deletes the table sitting inside another one as a row, but it does it for just the first one if i have, lets say, 3 input. the two other delete buttons don't work at all. please help me figure out what's wrong, and how can i fix it.
thanks a lot in advance.
Code:
<html>
<head>
<script type="text/javascript">
function deleteRow(r){
var i=r.parentNode.parentNode.rowIndex;
document.getElementById('myTable').deleteRow(i);
}
</script>
</head>
<?php
$NUM = $_POST["NUM"];
if (!$NUM){
?>
<form action="./script.php" method="post">
<textarea name="NUM" rows="8" cols="60"></textarea>
<BR>
<input type="submit" value="Click here to search">
<input type="reset" value="Clear" >
</form>
<?php
}else{
$NUM = $_POST["NUM"];
$array = preg_split ("/[\s]+/", $NUM);
foreach ($array as $number) {
$number = trim($number);
$text_info = curl_init("http://domain.com/$number");
....
(parse the data and let's say assign a value to $info)
....
echo "<TABLE BORDER=0 ID=\"myTable\" WIDTH=500>";
echo "<TR><TD>";
echo "<TABLE BORDER=1>";
echo "<TR><TD><B>Info:</B></TD><TD> $info </TD></TR>";
echo "</TABLE></TD>";
echo "<TD><input type=\"button\" value=\"Delete\" onclick=\"deleteRow(this)\"></TD></TR>";
echo "</TABLE>";
}
}
?>
Comment