Click to See Complete Forum and Search --> : onclick problem using php


zuzupus
08-15-2003, 09:48 AM
hi,

when i am using onClick on input field and mixing php with onclick im getting javascript error,anbody help me in this situation

<input type="radio" name="ddir" value="<?=$r->sys_pk ?>" onclick="sqlDoTable($names);" id="dir<?=$r->sys_pk ?>" />
function sqlDoTable ($result) {
print "<table border=1 cellpadding=3 cellspacing=0>";

print "<tr>";
for ($i=0;$i < mysql_num_fields($result);$i++) {
print "<th>" . mysql_field_name($result, $i) . "</th>";
}
print "</tr>\n";

// Print table Content
for ($i=0;$i < mysql_num_rows($result);$i++) {
print "<tr>";

$row = mysql_fetch_row($result);
foreach ($row as $value) {
// Make sure 0's are displayed
if (is_numeric($value)) { $value = (int)$value; }

// Make sure table is displayed correctly
if (empty($value) && ($value !== 0)) { $value = "&nbsp;"; } else { $value = htmlspecialchars($value); }
print "<td>$value</td>";
}

print "</tr>\n";
}

print "</table>";
}

actully the problem is when i select some directory in this link http://server2.vitodesign.com/scripts/test.phtml i am getting Jscript error

if anybody help me out how i can print this tvalue exactly below these directories will be very helpful

thanks in advance

Quasibobo
08-15-2003, 11:33 AM
Simple answer:

Javascript (onClick) is a clientside-function, PHP is serverside. You can't mix them (unless you submit values by posting them, but then, your REALLY are just posting..)