angelrovin
09-18-2009, 08:42 AM
hello guys/gals i have a problem with Javascript in php. i want to open a new window from a button. the problem is i am not that adept with javascript
ok here it goes i will display a list of names in a table and there is a view button in each names here's the code.
<table width="50%" border="2" cellspacing="0" cellpadding="1">
<tr>
<td width="84%">Name</td>
<td width="16%">View</td>
</tr>
<?php
require ("db.php");
$result=mysql_query("select * from names");
$while($row=mysql_fetch_array($result))
?>
<tr>
<td><?php echo $row['name']?></td>
<td><label>
<input type="submit" name="button" value="View" onclick="javascript:newwindow();" />
</label></td>
</tr>
</table>
now i need to pass a variable in the new window with the id of the said name the problem is i don't know where to put the variable $row['id'] to pass in the new window. can you guys help me with the code for the script of new window with a variable in it. the new window is a new page let say details.php and in it is a sql to display all the details regarding the name the sql will need an id that's why i need to pass a variable in the new windoow.
ok here it goes i will display a list of names in a table and there is a view button in each names here's the code.
<table width="50%" border="2" cellspacing="0" cellpadding="1">
<tr>
<td width="84%">Name</td>
<td width="16%">View</td>
</tr>
<?php
require ("db.php");
$result=mysql_query("select * from names");
$while($row=mysql_fetch_array($result))
?>
<tr>
<td><?php echo $row['name']?></td>
<td><label>
<input type="submit" name="button" value="View" onclick="javascript:newwindow();" />
</label></td>
</tr>
</table>
now i need to pass a variable in the new window with the id of the said name the problem is i don't know where to put the variable $row['id'] to pass in the new window. can you guys help me with the code for the script of new window with a variable in it. the new window is a new page let say details.php and in it is a sql to display all the details regarding the name the sql will need an id that's why i need to pass a variable in the new windoow.