JustinC474
Programmer
I am currently in an internship where my main goal is to construct a database that can be run client-side (in JS). I have it done it PHP and am having a very hard time switching it to javascript.
Rows = all info on one client
Columns = Specific information (name, date, etc)
Up until last monday i had never programmed PHP HTML or JavaScript so any help at all would be greatly appreciated.
This is the PHP function that creates a table (and works well)
($data = 2D array of client information; $numRows = number of rows; $columns = array of column headers)
any help at all would be great!! thanks!
Rows = all info on one client
Columns = Specific information (name, date, etc)
Up until last monday i had never programmed PHP HTML or JavaScript so any help at all would be greatly appreciated.
This is the PHP function that creates a table (and works well)
($data = 2D array of client information; $numRows = number of rows; $columns = array of column headers)
Code:
function printJSTable()
{
echo '<script language="Javascript" src = "java_script.js"></script>';
echo '<table id = "myTable" class = "halloween" border = "1">';
echo '<tr>';
foreach($this->columns as $header => $order)
{
echo '<th>';
echo $header;
echo '</th>';
}
echo '</tr>';
$counter = 0;
for($i = 0; $i < $this->numRows; $i++)
{
echo '<tr >';
foreach($this->data[$i] as $key => $value)
{
echo '<td id ="'.$counter.'" onmouseover = "ParaOver(this)" onmouseout = "ParaOut(this)" onclick = "changeInfo(id)">';
if($value!="")
echo $value;
else
{
echo '<input type = "button" value = "Empty" size = 10>';
}
$counter++;
echo '</td>';
}
echo '</tr>';
}
echo '</table>';
}
any help at all would be great!! thanks!